From 57d7911ae502b55ef2e78aa9a744a4a58c674a91 Mon Sep 17 00:00:00 2001 From: douglance <4741454+douglance@users.noreply.github.com> Date: Thu, 5 Mar 2026 16:00:47 -0500 Subject: [PATCH 1/2] feat: add EdgeChallengeManager contract support Add full EdgeChallengeManager (BOLD) integration including ABI, read/write functions, and decorator with curried address pattern. --- src/contracts/EdgeChallengeManager/index.ts | 2 + src/contracts/EdgeChallengeManager/v3.1.ts | 766 ++++++++++++++++++ src/decorators/edgeChallengeManagerActions.ts | 85 ++ .../edgeChallengeManagerActions.unit.test.ts | 152 ++++ ...allengeManagerPrepareTransactionRequest.ts | 81 ++ src/edgeChallengeManagerReadContract.ts | 41 + src/index.ts | 9 + wagmi.config.ts | 20 + 8 files changed, 1156 insertions(+) create mode 100644 src/contracts/EdgeChallengeManager/index.ts create mode 100644 src/contracts/EdgeChallengeManager/v3.1.ts create mode 100644 src/decorators/edgeChallengeManagerActions.ts create mode 100644 src/decorators/edgeChallengeManagerActions.unit.test.ts create mode 100644 src/edgeChallengeManagerPrepareTransactionRequest.ts create mode 100644 src/edgeChallengeManagerReadContract.ts diff --git a/src/contracts/EdgeChallengeManager/index.ts b/src/contracts/EdgeChallengeManager/index.ts new file mode 100644 index 00000000..b690aa44 --- /dev/null +++ b/src/contracts/EdgeChallengeManager/index.ts @@ -0,0 +1,2 @@ +// export the latest version +export * from './v3.1'; diff --git a/src/contracts/EdgeChallengeManager/v3.1.ts b/src/contracts/EdgeChallengeManager/v3.1.ts new file mode 100644 index 00000000..bd00932c --- /dev/null +++ b/src/contracts/EdgeChallengeManager/v3.1.ts @@ -0,0 +1,766 @@ +export const edgeChallengeManagerABI = [ + { inputs: [], stateMutability: 'nonpayable', type: 'constructor' }, + { + inputs: [ + { internalType: 'address', name: 'account', type: 'address' }, + { internalType: 'bytes32', name: 'mutualId', type: 'bytes32' }, + ], + name: 'AccountHasMadeLayerZeroRival', + type: 'error', + }, + { inputs: [], name: 'AssertionHashEmpty', type: 'error' }, + { + inputs: [ + { internalType: 'bytes32', name: 'h1', type: 'bytes32' }, + { internalType: 'bytes32', name: 'h2', type: 'bytes32' }, + ], + name: 'AssertionHashMismatch', + type: 'error', + }, + { inputs: [], name: 'AssertionNoSibling', type: 'error' }, + { inputs: [], name: 'AssertionNotPending', type: 'error' }, + { + inputs: [ + { internalType: 'uint8', name: 'levels', type: 'uint8' }, + ], + name: 'BigStepLevelsTooMany', + type: 'error', + }, + { + inputs: [ + { internalType: 'uint256', name: 'actual', type: 'uint256' }, + { internalType: 'uint256', name: 'expected', type: 'uint256' }, + ], + name: 'CachedTimeSufficient', + type: 'error', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + { internalType: 'bytes32', name: 'lowerChildId', type: 'bytes32' }, + { internalType: 'bytes32', name: 'upperChildId', type: 'bytes32' }, + ], + name: 'ChildrenAlreadySet', + type: 'error', + }, + { + inputs: [ + { internalType: 'uint8', name: 'argLevel', type: 'uint8' }, + { internalType: 'uint8', name: 'claimLevel', type: 'uint8' }, + ], + name: 'ClaimEdgeInvalidLevel', + type: 'error', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'claimId', type: 'bytes32' }, + ], + name: 'ClaimEdgeNotLengthOneRival', + type: 'error', + }, + { inputs: [], name: 'ClaimEdgeNotPending', type: 'error' }, + { + inputs: [ + { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + ], + name: 'EdgeAlreadyExists', + type: 'error', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + ], + name: 'EdgeAlreadyRefunded', + type: 'error', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + { internalType: 'bytes32', name: 'claimingEdgeId', type: 'bytes32' }, + ], + name: 'EdgeClaimMismatch', + type: 'error', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'edgeId1', type: 'bytes32' }, + { internalType: 'bytes32', name: 'edgeId2', type: 'bytes32' }, + { internalType: 'uint8', name: 'level1', type: 'uint8' }, + { internalType: 'uint8', name: 'level2', type: 'uint8' }, + ], + name: 'EdgeLevelInvalid', + type: 'error', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + { internalType: 'enum EdgeStatus', name: '', type: 'uint8' }, + ], + name: 'EdgeNotConfirmed', + type: 'error', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + ], + name: 'EdgeNotExists', + type: 'error', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + { internalType: 'address', name: 'staker', type: 'address' }, + { internalType: 'bytes32', name: 'claimId', type: 'bytes32' }, + ], + name: 'EdgeNotLayerZero', + type: 'error', + }, + { + inputs: [ + { internalType: 'uint256', name: 'length', type: 'uint256' }, + ], + name: 'EdgeNotLengthOne', + type: 'error', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + { internalType: 'enum EdgeStatus', name: 'status', type: 'uint8' }, + ], + name: 'EdgeNotPending', + type: 'error', + }, + { + inputs: [ + { internalType: 'uint8', name: 'level', type: 'uint8' }, + ], + name: 'EdgeTypeNotSmallStep', + type: 'error', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + ], + name: 'EdgeUnrivaled', + type: 'error', + }, + { inputs: [], name: 'EmptyArray', type: 'error' }, + { inputs: [], name: 'EmptyAssertionChain', type: 'error' }, + { inputs: [], name: 'EmptyChallengePeriod', type: 'error' }, + { inputs: [], name: 'EmptyClaimId', type: 'error' }, + { inputs: [], name: 'EmptyEdgeSpecificProof', type: 'error' }, + { inputs: [], name: 'EmptyEndMachineStatus', type: 'error' }, + { inputs: [], name: 'EmptyEndRoot', type: 'error' }, + { inputs: [], name: 'EmptyFirstRival', type: 'error' }, + { inputs: [], name: 'EmptyOneStepProofEntry', type: 'error' }, + { inputs: [], name: 'EmptyOriginId', type: 'error' }, + { inputs: [], name: 'EmptyPrefixProof', type: 'error' }, + { inputs: [], name: 'EmptyStakeReceiver', type: 'error' }, + { inputs: [], name: 'EmptyStaker', type: 'error' }, + { inputs: [], name: 'EmptyStartMachineStatus', type: 'error' }, + { inputs: [], name: 'EmptyStartRoot', type: 'error' }, + { + inputs: [ + { internalType: 'bytes32', name: 'endHistoryRoot', type: 'bytes32' }, + { internalType: 'bytes32', name: 'assertionEndRoot', type: 'bytes32' }, + ], + name: 'EndHistoryRootMismatch', + type: 'error', + }, + { + inputs: [ + { internalType: 'uint256', name: 'h1', type: 'uint256' }, + { internalType: 'uint256', name: 'h2', type: 'uint256' }, + ], + name: 'HeightDiffLtTwo', + type: 'error', + }, + { + inputs: [ + { internalType: 'uint256', name: 'totalBlocks', type: 'uint256' }, + { internalType: 'uint256', name: 'thresholdBlocks', type: 'uint256' }, + ], + name: 'InsufficientConfirmationBlocks', + type: 'error', + }, + { + inputs: [ + { internalType: 'enum EdgeType', name: 'edgeType', type: 'uint8' }, + ], + name: 'InvalidEdgeType', + type: 'error', + }, + { + inputs: [ + { internalType: 'uint256', name: 'actualHeight', type: 'uint256' }, + { internalType: 'uint256', name: 'expectedHeight', type: 'uint256' }, + ], + name: 'InvalidEndHeight', + type: 'error', + }, + { + inputs: [ + { internalType: 'uint256', name: 'start', type: 'uint256' }, + { internalType: 'uint256', name: 'end', type: 'uint256' }, + ], + name: 'InvalidHeights', + type: 'error', + }, + { + inputs: [ + { internalType: 'uint8', name: 'level', type: 'uint8' }, + { internalType: 'uint8', name: 'numBigStepLevels', type: 'uint8' }, + ], + name: 'LevelTooHigh', + type: 'error', + }, + { + inputs: [ + { internalType: 'uint256', name: 'actualLength', type: 'uint256' }, + { internalType: 'uint256', name: 'maxProofLength', type: 'uint256' }, + ], + name: 'MerkleProofTooLong', + type: 'error', + }, + { + inputs: [ + { internalType: 'uint256', name: 'val', type: 'uint256' }, + ], + name: 'NotPowerOfTwo', + type: 'error', + }, + { + inputs: [ + { internalType: 'address', name: 'account', type: 'address' }, + ], + name: 'NotValidator', + type: 'error', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'mutualId', type: 'bytes32' }, + { internalType: 'bytes32', name: 'originId', type: 'bytes32' }, + ], + name: 'OriginIdMutualIdMismatch', + type: 'error', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + { internalType: 'bytes32', name: 'confirmedRivalId', type: 'bytes32' }, + ], + name: 'RivalEdgeConfirmed', + type: 'error', + }, + { + inputs: [ + { internalType: 'uint256', name: 'stakeLevels', type: 'uint256' }, + { internalType: 'uint256', name: 'numLevels', type: 'uint256' }, + ], + name: 'StakeAmountsMismatch', + type: 'error', + }, + { inputs: [], name: 'ZeroBigStepLevels', type: 'error' }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + { indexed: true, internalType: 'bytes32', name: 'mutualId', type: 'bytes32' }, + { indexed: true, internalType: 'bytes32', name: 'originId', type: 'bytes32' }, + { indexed: false, internalType: 'bytes32', name: 'claimId', type: 'bytes32' }, + { indexed: false, internalType: 'uint256', name: 'length', type: 'uint256' }, + { indexed: false, internalType: 'uint8', name: 'level', type: 'uint8' }, + { indexed: false, internalType: 'bool', name: 'hasRival', type: 'bool' }, + { indexed: false, internalType: 'bool', name: 'isLayerZero', type: 'bool' }, + ], + name: 'EdgeAdded', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + { indexed: true, internalType: 'bytes32', name: 'lowerChildId', type: 'bytes32' }, + { indexed: true, internalType: 'bytes32', name: 'upperChildId', type: 'bytes32' }, + { indexed: false, internalType: 'bool', name: 'lowerChildAlreadyExists', type: 'bool' }, + ], + name: 'EdgeBisected', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + { indexed: true, internalType: 'bytes32', name: 'mutualId', type: 'bytes32' }, + ], + name: 'EdgeConfirmedByOneStepProof', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + { indexed: true, internalType: 'bytes32', name: 'mutualId', type: 'bytes32' }, + { indexed: false, internalType: 'uint256', name: 'totalTimeUnrivaled', type: 'uint256' }, + ], + name: 'EdgeConfirmedByTime', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + { indexed: true, internalType: 'bytes32', name: 'mutualId', type: 'bytes32' }, + { indexed: false, internalType: 'address', name: 'stakeToken', type: 'address' }, + { indexed: false, internalType: 'uint256', name: 'stakeAmount', type: 'uint256' }, + ], + name: 'EdgeRefunded', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: 'uint8', name: 'version', type: 'uint8' }, + ], + name: 'Initialized', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + { indexed: false, internalType: 'uint256', name: 'newValue', type: 'uint256' }, + ], + name: 'TimerCacheUpdated', + type: 'event', + }, + { + inputs: [], + name: 'LAYERZERO_BIGSTEPEDGE_HEIGHT', + outputs: [ + { internalType: 'uint256', name: '', type: 'uint256' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'LAYERZERO_BLOCKEDGE_HEIGHT', + outputs: [ + { internalType: 'uint256', name: '', type: 'uint256' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'LAYERZERO_SMALLSTEPEDGE_HEIGHT', + outputs: [ + { internalType: 'uint256', name: '', type: 'uint256' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'NUM_BIGSTEP_LEVEL', + outputs: [ + { internalType: 'uint8', name: '', type: 'uint8' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'assertionChain', + outputs: [ + { internalType: 'contract IAssertionChain', name: '', type: 'address' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + { internalType: 'bytes32', name: 'bisectionHistoryRoot', type: 'bytes32' }, + { internalType: 'bytes', name: 'prefixProof', type: 'bytes' }, + ], + name: 'bisectEdge', + outputs: [ + { internalType: 'bytes32', name: '', type: 'bytes32' }, + { internalType: 'bytes32', name: '', type: 'bytes32' }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'uint8', name: 'level', type: 'uint8' }, + { internalType: 'bytes32', name: 'originId', type: 'bytes32' }, + { internalType: 'uint256', name: 'startHeight', type: 'uint256' }, + { internalType: 'bytes32', name: 'startHistoryRoot', type: 'bytes32' }, + { internalType: 'uint256', name: 'endHeight', type: 'uint256' }, + { internalType: 'bytes32', name: 'endHistoryRoot', type: 'bytes32' }, + ], + name: 'calculateEdgeId', + outputs: [ + { internalType: 'bytes32', name: '', type: 'bytes32' }, + ], + stateMutability: 'pure', + type: 'function', + }, + { + inputs: [ + { internalType: 'uint8', name: 'level', type: 'uint8' }, + { internalType: 'bytes32', name: 'originId', type: 'bytes32' }, + { internalType: 'uint256', name: 'startHeight', type: 'uint256' }, + { internalType: 'bytes32', name: 'startHistoryRoot', type: 'bytes32' }, + { internalType: 'uint256', name: 'endHeight', type: 'uint256' }, + ], + name: 'calculateMutualId', + outputs: [ + { internalType: 'bytes32', name: '', type: 'bytes32' }, + ], + stateMutability: 'pure', + type: 'function', + }, + { + inputs: [], + name: 'challengePeriodBlocks', + outputs: [ + { internalType: 'uint64', name: '', type: 'uint64' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + { + components: [ + { internalType: 'bytes32', name: 'beforeHash', type: 'bytes32' }, + { internalType: 'bytes', name: 'proof', type: 'bytes' }, + ], + internalType: 'struct OneStepData', + name: 'oneStepData', + type: 'tuple', + }, + { + components: [ + { internalType: 'bytes32', name: 'wasmModuleRoot', type: 'bytes32' }, + { internalType: 'uint256', name: 'requiredStake', type: 'uint256' }, + { internalType: 'address', name: 'challengeManager', type: 'address' }, + { internalType: 'uint64', name: 'confirmPeriodBlocks', type: 'uint64' }, + { internalType: 'uint64', name: 'nextInboxPosition', type: 'uint64' }, + ], + internalType: 'struct ConfigData', + name: 'prevConfig', + type: 'tuple', + }, + { internalType: 'bytes32[]', name: 'beforeHistoryInclusionProof', type: 'bytes32[]' }, + { internalType: 'bytes32[]', name: 'afterHistoryInclusionProof', type: 'bytes32[]' }, + ], + name: 'confirmEdgeByOneStepProof', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + { + components: [ + { + components: [ + { + components: [ + { internalType: 'bytes32[2]', name: 'bytes32Vals', type: 'bytes32[2]' }, + { internalType: 'uint64[2]', name: 'u64Vals', type: 'uint64[2]' }, + ], + internalType: 'struct GlobalState', + name: 'globalState', + type: 'tuple', + }, + { internalType: 'enum MachineStatus', name: 'machineStatus', type: 'uint8' }, + { internalType: 'bytes32', name: 'endHistoryRoot', type: 'bytes32' }, + ], + internalType: 'struct AssertionState', + name: 'assertionState', + type: 'tuple', + }, + { internalType: 'bytes32', name: 'prevAssertionHash', type: 'bytes32' }, + { internalType: 'bytes32', name: 'inboxAcc', type: 'bytes32' }, + ], + internalType: 'struct AssertionStateData', + name: 'claimStateData', + type: 'tuple', + }, + ], + name: 'confirmEdgeByTime', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'mutualId', type: 'bytes32' }, + ], + name: 'confirmedRival', + outputs: [ + { internalType: 'bytes32', name: '', type: 'bytes32' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + components: [ + { internalType: 'uint8', name: 'level', type: 'uint8' }, + { internalType: 'bytes32', name: 'endHistoryRoot', type: 'bytes32' }, + { internalType: 'uint256', name: 'endHeight', type: 'uint256' }, + { internalType: 'bytes32', name: 'claimId', type: 'bytes32' }, + { internalType: 'bytes', name: 'prefixProof', type: 'bytes' }, + { internalType: 'bytes', name: 'proof', type: 'bytes' }, + ], + internalType: 'struct CreateEdgeArgs', + name: 'args', + type: 'tuple', + }, + ], + name: 'createLayerZeroEdge', + outputs: [ + { internalType: 'bytes32', name: '', type: 'bytes32' }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + ], + name: 'edgeExists', + outputs: [ + { internalType: 'bool', name: '', type: 'bool' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + ], + name: 'edgeLength', + outputs: [ + { internalType: 'uint256', name: '', type: 'uint256' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'excessStakeReceiver', + outputs: [ + { internalType: 'address', name: '', type: 'address' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'mutualId', type: 'bytes32' }, + ], + name: 'firstRival', + outputs: [ + { internalType: 'bytes32', name: '', type: 'bytes32' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + ], + name: 'getEdge', + outputs: [ + { + components: [ + { internalType: 'bytes32', name: 'originId', type: 'bytes32' }, + { internalType: 'bytes32', name: 'startHistoryRoot', type: 'bytes32' }, + { internalType: 'uint256', name: 'startHeight', type: 'uint256' }, + { internalType: 'bytes32', name: 'endHistoryRoot', type: 'bytes32' }, + { internalType: 'uint256', name: 'endHeight', type: 'uint256' }, + { internalType: 'bytes32', name: 'lowerChildId', type: 'bytes32' }, + { internalType: 'bytes32', name: 'upperChildId', type: 'bytes32' }, + { internalType: 'bytes32', name: 'claimId', type: 'bytes32' }, + { internalType: 'address', name: 'staker', type: 'address' }, + { internalType: 'uint64', name: 'createdAtBlock', type: 'uint64' }, + { internalType: 'uint64', name: 'confirmedAtBlock', type: 'uint64' }, + { internalType: 'enum EdgeStatus', name: 'status', type: 'uint8' }, + { internalType: 'uint8', name: 'level', type: 'uint8' }, + { internalType: 'bool', name: 'refunded', type: 'bool' }, + { internalType: 'uint64', name: 'totalTimeUnrivaledCache', type: 'uint64' }, + ], + internalType: 'struct ChallengeEdge', + name: '', + type: 'tuple', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'enum EdgeType', name: 'eType', type: 'uint8' }, + ], + name: 'getLayerZeroEndHeight', + outputs: [ + { internalType: 'uint256', name: '', type: 'uint256' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + ], + name: 'getPrevAssertionHash', + outputs: [ + { internalType: 'bytes32', name: '', type: 'bytes32' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + ], + name: 'hasLengthOneRival', + outputs: [ + { internalType: 'bool', name: '', type: 'bool' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: 'account', type: 'address' }, + { internalType: 'bytes32', name: 'mutualId', type: 'bytes32' }, + ], + name: 'hasMadeLayerZeroRival', + outputs: [ + { internalType: 'bool', name: '', type: 'bool' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + ], + name: 'hasRival', + outputs: [ + { internalType: 'bool', name: '', type: 'bool' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'contract IAssertionChain', name: '_assertionChain', type: 'address' }, + { internalType: 'uint64', name: '_challengePeriodBlocks', type: 'uint64' }, + { internalType: 'contract IOneStepProofEntry', name: '_oneStepProofEntry', type: 'address' }, + { internalType: 'uint256', name: 'layerZeroBlockEdgeHeight', type: 'uint256' }, + { internalType: 'uint256', name: 'layerZeroBigStepEdgeHeight', type: 'uint256' }, + { internalType: 'uint256', name: 'layerZeroSmallStepEdgeHeight', type: 'uint256' }, + { internalType: 'contract IERC20', name: '_stakeToken', type: 'address' }, + { internalType: 'address', name: '_excessStakeReceiver', type: 'address' }, + { internalType: 'uint8', name: '_numBigStepLevel', type: 'uint8' }, + { internalType: 'uint256[]', name: '_stakeAmounts', type: 'uint256[]' }, + ], + name: 'initialize', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'bytes32[]', name: 'edgeIds', type: 'bytes32[]' }, + { internalType: 'uint256', name: 'maximumCachedTime', type: 'uint256' }, + ], + name: 'multiUpdateTimeCacheByChildren', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'oneStepProofEntry', + outputs: [ + { internalType: 'contract IOneStepProofEntry', name: '', type: 'address' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + ], + name: 'refundStake', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'uint256', name: '', type: 'uint256' }, + ], + name: 'stakeAmounts', + outputs: [ + { internalType: 'uint256', name: '', type: 'uint256' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'stakeToken', + outputs: [ + { internalType: 'contract IERC20', name: '', type: 'address' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + ], + name: 'timeUnrivaled', + outputs: [ + { internalType: 'uint256', name: '', type: 'uint256' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + { internalType: 'uint256', name: 'maximumCachedTime', type: 'uint256' }, + ], + name: 'updateTimerCacheByChildren', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, + { internalType: 'bytes32', name: 'claimingEdgeId', type: 'bytes32' }, + { internalType: 'uint256', name: 'maximumCachedTime', type: 'uint256' }, + ], + name: 'updateTimerCacheByClaim', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, +] as const; diff --git a/src/decorators/edgeChallengeManagerActions.ts b/src/decorators/edgeChallengeManagerActions.ts new file mode 100644 index 00000000..39cfe286 --- /dev/null +++ b/src/decorators/edgeChallengeManagerActions.ts @@ -0,0 +1,85 @@ +import { Transport, Chain, PrepareTransactionRequestReturnType, PublicClient, Address } from 'viem'; + +import { + edgeChallengeManagerReadContract, + EdgeChallengeManagerReadContractParameters, + EdgeChallengeManagerReadContractReturnType, +} from '../edgeChallengeManagerReadContract'; +import { + EdgeChallengeManagerFunctionName, + edgeChallengeManagerPrepareTransactionRequest, + EdgeChallengeManagerPrepareTransactionRequestParameters, +} from '../edgeChallengeManagerPrepareTransactionRequest'; + +type EdgeChallengeManagerReadContractArgs< + TChallengeManager extends Address | undefined, + TFunctionName extends EdgeChallengeManagerFunctionName, +> = TChallengeManager extends Address + ? Omit, 'challengeManager'> & { + challengeManager?: Address; + } + : EdgeChallengeManagerReadContractParameters; +type EdgeChallengeManagerPrepareTransactionRequestArgs< + TChallengeManager extends Address | undefined, + TFunctionName extends EdgeChallengeManagerFunctionName, +> = TChallengeManager extends Address + ? Omit< + EdgeChallengeManagerPrepareTransactionRequestParameters, + 'challengeManager' + > & { + challengeManager?: Address; + } + : EdgeChallengeManagerPrepareTransactionRequestParameters; + +export type EdgeChallengeManagerActions< + TChallengeManager extends Address | undefined, + TChain extends Chain | undefined = Chain | undefined, +> = { + edgeChallengeManagerReadContract: ( + args: EdgeChallengeManagerReadContractArgs, + ) => Promise>; + + edgeChallengeManagerPrepareTransactionRequest: < + TFunctionName extends EdgeChallengeManagerFunctionName, + >( + args: EdgeChallengeManagerPrepareTransactionRequestArgs, + ) => Promise & { chainId: number }>; +}; + +export function edgeChallengeManagerActions< + TParams extends { challengeManager?: Address }, + TTransport extends Transport = Transport, + TChain extends Chain | undefined = Chain | undefined, +>({ challengeManager }: TParams) { + return function edgeChallengeManagerActionsWithChallengeManager( + client: PublicClient, + ) { + const edgeChallengeManagerExtensions: EdgeChallengeManagerActions< + TParams['challengeManager'], + TChain + > = { + edgeChallengeManagerReadContract: ( + args: EdgeChallengeManagerReadContractArgs, + ) => { + return edgeChallengeManagerReadContract(client, { + ...args, + challengeManager: args.challengeManager || challengeManager, + } as EdgeChallengeManagerReadContractParameters); + }, + edgeChallengeManagerPrepareTransactionRequest: < + TFunctionName extends EdgeChallengeManagerFunctionName, + >( + args: EdgeChallengeManagerPrepareTransactionRequestArgs< + TParams['challengeManager'], + TFunctionName + >, + ) => { + return edgeChallengeManagerPrepareTransactionRequest(client, { + ...args, + challengeManager: args.challengeManager || challengeManager, + } as EdgeChallengeManagerPrepareTransactionRequestParameters); + }, + }; + return edgeChallengeManagerExtensions; + }; +} diff --git a/src/decorators/edgeChallengeManagerActions.unit.test.ts b/src/decorators/edgeChallengeManagerActions.unit.test.ts new file mode 100644 index 00000000..a91a0e5e --- /dev/null +++ b/src/decorators/edgeChallengeManagerActions.unit.test.ts @@ -0,0 +1,152 @@ +import { it, expect, expectTypeOf, describe, vi } from 'vitest'; + +import { + AbiEncodingLengthMismatchError, + AbiFunctionNotFoundError, + createPublicClient, + http, + createClient, + ClientConfig, +} from 'viem'; +import { edgeChallengeManagerActions } from './edgeChallengeManagerActions'; +import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts'; +import { edgeChallengeManagerABI } from '../contracts/EdgeChallengeManager'; +import { mainnet } from 'viem/chains'; + +const challengeManagerAddress = '0x5eF0D09d1E6204141B4d37530808eD19f60FBa35'; + +const client = createPublicClient({ + chain: mainnet, + transport: http(), +}).extend(edgeChallengeManagerActions({ challengeManager: challengeManagerAddress })); + +const randomAccount = privateKeyToAccount(generatePrivateKey()); + +// Mock readContract (called internally with client.edgeChallengeManagerReadContract) +vi.mock('viem', async () => { + const viem: Record = await vi.importActual('viem'); + + return { + ...viem, + createPublicClient: (args: ClientConfig) => { + const client = createClient(args); + Object.assign(client, { + readContract: vi.fn(), + }); + return client; + }, + }; +}); + +describe('EdgeChallengeManager parameter:', () => { + it('require challengeManager parameter if not passed initially to the actions during initialization', () => { + const clientWithoutChallengeManagerAddress = createPublicClient({ + chain: mainnet, + transport: http(), + }).extend(edgeChallengeManagerActions({})); + + // @ts-expect-error challengeManager is required + clientWithoutChallengeManagerAddress.edgeChallengeManagerReadContract({ + functionName: 'edgeExists', + args: ['0x0000000000000000000000000000000000000000000000000000000000000001'], + }); + + expectTypeOf< + typeof clientWithoutChallengeManagerAddress.edgeChallengeManagerReadContract<'edgeExists'> + >().toBeCallableWith({ + functionName: 'edgeExists', + args: ['0x0000000000000000000000000000000000000000000000000000000000000001'], + challengeManager: challengeManagerAddress, + }); + }); + + it("Doesn't require challengeManager parameter if passed initially to the actions during initialization", async () => { + const clientWithChallengeManagerAddress = createPublicClient({ + chain: mainnet, + transport: http(), + }).extend(edgeChallengeManagerActions({ challengeManager: challengeManagerAddress })); + + expectTypeOf< + typeof clientWithChallengeManagerAddress.edgeChallengeManagerReadContract<'edgeExists'> + >().toBeCallableWith({ + functionName: 'edgeExists', + args: ['0x0000000000000000000000000000000000000000000000000000000000000001'], + }); + + await clientWithChallengeManagerAddress.edgeChallengeManagerReadContract({ + functionName: 'edgeExists', + args: ['0x0000000000000000000000000000000000000000000000000000000000000001'], + }); + + expect(clientWithChallengeManagerAddress.readContract).toHaveBeenCalledWith({ + address: challengeManagerAddress, + abi: edgeChallengeManagerABI, + functionName: 'edgeExists', + args: ['0x0000000000000000000000000000000000000000000000000000000000000001'], + }); + }); + + it('Allow challengeManager override parameter if passed initially to the actions during initialization', async () => { + const clientWithChallengeManagerAddress = createPublicClient({ + chain: mainnet, + transport: http(), + }).extend(edgeChallengeManagerActions({ challengeManager: challengeManagerAddress })); + + expectTypeOf< + typeof clientWithChallengeManagerAddress.edgeChallengeManagerReadContract<'edgeExists'> + >().toBeCallableWith({ + functionName: 'edgeExists', + args: ['0x0000000000000000000000000000000000000000000000000000000000000001'], + challengeManager: challengeManagerAddress, + }); + + await clientWithChallengeManagerAddress.edgeChallengeManagerReadContract({ + functionName: 'edgeExists', + args: ['0x0000000000000000000000000000000000000000000000000000000000000001'], + challengeManager: randomAccount.address, + }); + + expect(clientWithChallengeManagerAddress.readContract).toHaveBeenCalledWith({ + address: randomAccount.address, + abi: edgeChallengeManagerABI, + functionName: 'edgeExists', + args: ['0x0000000000000000000000000000000000000000000000000000000000000001'], + }); + }); +}); + +it('Infer parameters based on function name', async () => { + await expect( + client.edgeChallengeManagerPrepareTransactionRequest({ + functionName: 'refundStake', + // @ts-expect-error Args are missing + args: [], + account: randomAccount.address, + }), + ).rejects.toThrowError(AbiEncodingLengthMismatchError); + + await expect( + client + // @ts-expect-error Args are required for `refundStake` + .edgeChallengeManagerPrepareTransactionRequest({ + functionName: 'refundStake', + account: randomAccount.address, + }), + ).rejects.toThrow(AbiEncodingLengthMismatchError); + + expectTypeOf< + typeof client.edgeChallengeManagerPrepareTransactionRequest<'refundStake'> + >().toBeCallableWith({ + functionName: 'refundStake', + args: ['0x0000000000000000000000000000000000000000000000000000000000000001'], + account: randomAccount.address, + }); + + // Function doesn't exist + await expect( + client.edgeChallengeManagerPrepareTransactionRequest({ + // @ts-expect-error Function not available + functionName: 'notExisting', + }), + ).rejects.toThrowError(AbiFunctionNotFoundError); +}); diff --git a/src/edgeChallengeManagerPrepareTransactionRequest.ts b/src/edgeChallengeManagerPrepareTransactionRequest.ts new file mode 100644 index 00000000..70bda1d8 --- /dev/null +++ b/src/edgeChallengeManagerPrepareTransactionRequest.ts @@ -0,0 +1,81 @@ +import { + PublicClient, + encodeFunctionData, + EncodeFunctionDataParameters, + Address, + Transport, + Chain, +} from 'viem'; + +import { edgeChallengeManagerABI } from './contracts/EdgeChallengeManager'; +import { GetFunctionName } from './types/utils'; +import { validateParentChain } from './types/ParentChain'; + +export type EdgeChallengeManagerAbi = typeof edgeChallengeManagerABI; +export type EdgeChallengeManagerFunctionName = GetFunctionName; + +type EdgeChallengeManagerEncodeFunctionDataParameters< + TFunctionName extends EdgeChallengeManagerFunctionName, +> = EncodeFunctionDataParameters; + +function edgeChallengeManagerEncodeFunctionData< + TFunctionName extends EdgeChallengeManagerFunctionName, +>({ abi, functionName, args }: EdgeChallengeManagerEncodeFunctionDataParameters) { + return encodeFunctionData({ + abi, + functionName, + args, + }); +} + +export type EdgeChallengeManagerPrepareFunctionDataParameters< + TFunctionName extends EdgeChallengeManagerFunctionName, +> = EdgeChallengeManagerEncodeFunctionDataParameters & { + abi: EdgeChallengeManagerAbi; + challengeManager: Address; +}; + +export function edgeChallengeManagerPrepareFunctionData< + TFunctionName extends EdgeChallengeManagerFunctionName, +>(params: EdgeChallengeManagerPrepareFunctionDataParameters) { + return { + to: params.challengeManager, + data: edgeChallengeManagerEncodeFunctionData( + params as EdgeChallengeManagerEncodeFunctionDataParameters, + ), + value: BigInt(0), + }; +} + +export type EdgeChallengeManagerPrepareTransactionRequestParameters< + TFunctionName extends EdgeChallengeManagerFunctionName, +> = Omit, 'abi'> & { + account: Address; +}; + +export async function edgeChallengeManagerPrepareTransactionRequest< + TFunctionName extends EdgeChallengeManagerFunctionName, + TTransport extends Transport = Transport, + TChain extends Chain | undefined = Chain | undefined, +>( + client: PublicClient, + params: EdgeChallengeManagerPrepareTransactionRequestParameters, +) { + const { chainId } = validateParentChain(client); + + const { to, data, value } = edgeChallengeManagerPrepareFunctionData({ + ...params, + abi: edgeChallengeManagerABI, + } as unknown as EdgeChallengeManagerPrepareFunctionDataParameters); + + // @ts-expect-error -- todo: fix viem type issue + const request = await client.prepareTransactionRequest({ + chain: client.chain, + to, + data, + value, + account: params.account, + }); + + return { ...request, chainId }; +} diff --git a/src/edgeChallengeManagerReadContract.ts b/src/edgeChallengeManagerReadContract.ts new file mode 100644 index 00000000..10ec4ec7 --- /dev/null +++ b/src/edgeChallengeManagerReadContract.ts @@ -0,0 +1,41 @@ +import { + Address, + Chain, + GetFunctionArgs, + PublicClient, + ReadContractReturnType, + Transport, +} from 'viem'; + +import { edgeChallengeManagerABI } from './contracts/EdgeChallengeManager'; +import { + EdgeChallengeManagerAbi, + EdgeChallengeManagerFunctionName, +} from './edgeChallengeManagerPrepareTransactionRequest'; + +export type EdgeChallengeManagerReadContractParameters< + TFunctionName extends EdgeChallengeManagerFunctionName, +> = { + functionName: TFunctionName; + challengeManager: Address; +} & GetFunctionArgs; + +export type EdgeChallengeManagerReadContractReturnType< + TFunctionName extends EdgeChallengeManagerFunctionName, +> = ReadContractReturnType; + +export function edgeChallengeManagerReadContract< + TChain extends Chain | undefined, + TFunctionName extends EdgeChallengeManagerFunctionName, +>( + client: PublicClient, + params: EdgeChallengeManagerReadContractParameters, +): Promise> { + // @ts-expect-error -- todo: fix viem type issue + return client.readContract({ + address: params.challengeManager, + abi: edgeChallengeManagerABI, + functionName: params.functionName, + args: params.args, + }); +} diff --git a/src/index.ts b/src/index.ts index e05d0fe4..3bdb09ce 100644 --- a/src/index.ts +++ b/src/index.ts @@ -87,6 +87,11 @@ import { rollupAdminLogicPrepareFunctionData, RollupAdminLogicPrepareFunctionDataParameters, } from './rollupAdminLogicPrepareTransactionRequest'; +import { + edgeChallengeManagerPrepareFunctionData, + EdgeChallengeManagerPrepareFunctionDataParameters, +} from './edgeChallengeManagerPrepareTransactionRequest'; +import { edgeChallengeManagerActions } from './decorators/edgeChallengeManagerActions'; import { rollupAdminLogicPublicActions } from './decorators/rollupAdminLogicPublicActions'; import { ChainConfig, ChainConfigArbitrumParams } from './types/ChainConfig'; @@ -211,6 +216,10 @@ export { rollupAdminLogicPrepareFunctionData, RollupAdminLogicPrepareFunctionDataParameters, // + edgeChallengeManagerActions, + edgeChallengeManagerPrepareFunctionData, + EdgeChallengeManagerPrepareFunctionDataParameters, + // createRollupEncodeFunctionData, // createRollupPrepareTransactionRequest, diff --git a/wagmi.config.ts b/wagmi.config.ts index 4fef3dfc..b9432b0f 100644 --- a/wagmi.config.ts +++ b/wagmi.config.ts @@ -194,6 +194,26 @@ const contracts: ContractConfig[] = [ [nitroTestnodeL2.id]: '0x38F35Af53bF913c439eaB06A367e09D6eb253492', }, }, + { + name: 'EdgeChallengeManager', + version: '3.1', + address: { + // mainnet L1 + [mainnet.id]: '0x93069fFd7730733eCfd57A0D2D528CF686248524', + // mainnet L2 + [arbitrumOne.id]: '0x1Ef281CD6BD48affD9C44Cb590858FCfF92DE821', + [arbitrumNova.id]: '0xD3dE403eADdf791104918E9C9336B434AE7DDA01', + [base.id]: '0xaf58472D08D7dBCCC73D5f58D26b2bD9Ef43A5c2', + // testnet L1 + [sepolia.id]: '0x6B21677CeAd8bF6526d4A27D144579c9eB46f0eB', + // testnet L2 + [arbitrumSepolia.id]: '0x22DD61cF5e1f19A4D98C08478E2f83DFb3FCe44C', + [baseSepolia.id]: '0x409CcfCeDF546DE7B855191cC5B7f6EF318d406C', + // local nitro-testnode (on "release" branch with --tokenbridge --l3node --l3-token-bridge flags) + [nitroTestnodeL1.id]: '0x0000000000000000000000000000000000000000', + [nitroTestnodeL2.id]: '0x0000000000000000000000000000000000000000', + }, + }, { name: 'ArbOwner', address: '0x0000000000000000000000000000000000000070', From 4694e447b58fc05b8b97238a138adb10e8378dc7 Mon Sep 17 00:00:00 2001 From: douglance <4741454+douglance@users.noreply.github.com> Date: Thu, 5 Mar 2026 16:20:00 -0500 Subject: [PATCH 2/2] style: format EdgeChallengeManager ABI with prettier --- src/contracts/EdgeChallengeManager/v3.1.ts | 188 ++++++--------------- 1 file changed, 47 insertions(+), 141 deletions(-) diff --git a/src/contracts/EdgeChallengeManager/v3.1.ts b/src/contracts/EdgeChallengeManager/v3.1.ts index bd00932c..2a1ea71f 100644 --- a/src/contracts/EdgeChallengeManager/v3.1.ts +++ b/src/contracts/EdgeChallengeManager/v3.1.ts @@ -20,9 +20,7 @@ export const edgeChallengeManagerABI = [ { inputs: [], name: 'AssertionNoSibling', type: 'error' }, { inputs: [], name: 'AssertionNotPending', type: 'error' }, { - inputs: [ - { internalType: 'uint8', name: 'levels', type: 'uint8' }, - ], + inputs: [{ internalType: 'uint8', name: 'levels', type: 'uint8' }], name: 'BigStepLevelsTooMany', type: 'error', }, @@ -52,24 +50,18 @@ export const edgeChallengeManagerABI = [ type: 'error', }, { - inputs: [ - { internalType: 'bytes32', name: 'claimId', type: 'bytes32' }, - ], + inputs: [{ internalType: 'bytes32', name: 'claimId', type: 'bytes32' }], name: 'ClaimEdgeNotLengthOneRival', type: 'error', }, { inputs: [], name: 'ClaimEdgeNotPending', type: 'error' }, { - inputs: [ - { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, - ], + inputs: [{ internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }], name: 'EdgeAlreadyExists', type: 'error', }, { - inputs: [ - { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, - ], + inputs: [{ internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }], name: 'EdgeAlreadyRefunded', type: 'error', }, @@ -100,9 +92,7 @@ export const edgeChallengeManagerABI = [ type: 'error', }, { - inputs: [ - { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, - ], + inputs: [{ internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }], name: 'EdgeNotExists', type: 'error', }, @@ -116,9 +106,7 @@ export const edgeChallengeManagerABI = [ type: 'error', }, { - inputs: [ - { internalType: 'uint256', name: 'length', type: 'uint256' }, - ], + inputs: [{ internalType: 'uint256', name: 'length', type: 'uint256' }], name: 'EdgeNotLengthOne', type: 'error', }, @@ -131,16 +119,12 @@ export const edgeChallengeManagerABI = [ type: 'error', }, { - inputs: [ - { internalType: 'uint8', name: 'level', type: 'uint8' }, - ], + inputs: [{ internalType: 'uint8', name: 'level', type: 'uint8' }], name: 'EdgeTypeNotSmallStep', type: 'error', }, { - inputs: [ - { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, - ], + inputs: [{ internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }], name: 'EdgeUnrivaled', type: 'error', }, @@ -184,9 +168,7 @@ export const edgeChallengeManagerABI = [ type: 'error', }, { - inputs: [ - { internalType: 'enum EdgeType', name: 'edgeType', type: 'uint8' }, - ], + inputs: [{ internalType: 'enum EdgeType', name: 'edgeType', type: 'uint8' }], name: 'InvalidEdgeType', type: 'error', }, @@ -223,16 +205,12 @@ export const edgeChallengeManagerABI = [ type: 'error', }, { - inputs: [ - { internalType: 'uint256', name: 'val', type: 'uint256' }, - ], + inputs: [{ internalType: 'uint256', name: 'val', type: 'uint256' }], name: 'NotPowerOfTwo', type: 'error', }, { - inputs: [ - { internalType: 'address', name: 'account', type: 'address' }, - ], + inputs: [{ internalType: 'address', name: 'account', type: 'address' }], name: 'NotValidator', type: 'error', }, @@ -319,9 +297,7 @@ export const edgeChallengeManagerABI = [ }, { anonymous: false, - inputs: [ - { indexed: false, internalType: 'uint8', name: 'version', type: 'uint8' }, - ], + inputs: [{ indexed: false, internalType: 'uint8', name: 'version', type: 'uint8' }], name: 'Initialized', type: 'event', }, @@ -337,45 +313,35 @@ export const edgeChallengeManagerABI = [ { inputs: [], name: 'LAYERZERO_BIGSTEPEDGE_HEIGHT', - outputs: [ - { internalType: 'uint256', name: '', type: 'uint256' }, - ], + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], stateMutability: 'view', type: 'function', }, { inputs: [], name: 'LAYERZERO_BLOCKEDGE_HEIGHT', - outputs: [ - { internalType: 'uint256', name: '', type: 'uint256' }, - ], + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], stateMutability: 'view', type: 'function', }, { inputs: [], name: 'LAYERZERO_SMALLSTEPEDGE_HEIGHT', - outputs: [ - { internalType: 'uint256', name: '', type: 'uint256' }, - ], + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], stateMutability: 'view', type: 'function', }, { inputs: [], name: 'NUM_BIGSTEP_LEVEL', - outputs: [ - { internalType: 'uint8', name: '', type: 'uint8' }, - ], + outputs: [{ internalType: 'uint8', name: '', type: 'uint8' }], stateMutability: 'view', type: 'function', }, { inputs: [], name: 'assertionChain', - outputs: [ - { internalType: 'contract IAssertionChain', name: '', type: 'address' }, - ], + outputs: [{ internalType: 'contract IAssertionChain', name: '', type: 'address' }], stateMutability: 'view', type: 'function', }, @@ -403,9 +369,7 @@ export const edgeChallengeManagerABI = [ { internalType: 'bytes32', name: 'endHistoryRoot', type: 'bytes32' }, ], name: 'calculateEdgeId', - outputs: [ - { internalType: 'bytes32', name: '', type: 'bytes32' }, - ], + outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], stateMutability: 'pure', type: 'function', }, @@ -418,18 +382,14 @@ export const edgeChallengeManagerABI = [ { internalType: 'uint256', name: 'endHeight', type: 'uint256' }, ], name: 'calculateMutualId', - outputs: [ - { internalType: 'bytes32', name: '', type: 'bytes32' }, - ], + outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], stateMutability: 'pure', type: 'function', }, { inputs: [], name: 'challengePeriodBlocks', - outputs: [ - { internalType: 'uint64', name: '', type: 'uint64' }, - ], + outputs: [{ internalType: 'uint64', name: '', type: 'uint64' }], stateMutability: 'view', type: 'function', }, @@ -502,13 +462,9 @@ export const edgeChallengeManagerABI = [ type: 'function', }, { - inputs: [ - { internalType: 'bytes32', name: 'mutualId', type: 'bytes32' }, - ], + inputs: [{ internalType: 'bytes32', name: 'mutualId', type: 'bytes32' }], name: 'confirmedRival', - outputs: [ - { internalType: 'bytes32', name: '', type: 'bytes32' }, - ], + outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], stateMutability: 'view', type: 'function', }, @@ -529,58 +485,40 @@ export const edgeChallengeManagerABI = [ }, ], name: 'createLayerZeroEdge', - outputs: [ - { internalType: 'bytes32', name: '', type: 'bytes32' }, - ], + outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], stateMutability: 'nonpayable', type: 'function', }, { - inputs: [ - { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, - ], + inputs: [{ internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }], name: 'edgeExists', - outputs: [ - { internalType: 'bool', name: '', type: 'bool' }, - ], + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], stateMutability: 'view', type: 'function', }, { - inputs: [ - { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, - ], + inputs: [{ internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }], name: 'edgeLength', - outputs: [ - { internalType: 'uint256', name: '', type: 'uint256' }, - ], + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], stateMutability: 'view', type: 'function', }, { inputs: [], name: 'excessStakeReceiver', - outputs: [ - { internalType: 'address', name: '', type: 'address' }, - ], + outputs: [{ internalType: 'address', name: '', type: 'address' }], stateMutability: 'view', type: 'function', }, { - inputs: [ - { internalType: 'bytes32', name: 'mutualId', type: 'bytes32' }, - ], + inputs: [{ internalType: 'bytes32', name: 'mutualId', type: 'bytes32' }], name: 'firstRival', - outputs: [ - { internalType: 'bytes32', name: '', type: 'bytes32' }, - ], + outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], stateMutability: 'view', type: 'function', }, { - inputs: [ - { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, - ], + inputs: [{ internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }], name: 'getEdge', outputs: [ { @@ -610,35 +548,23 @@ export const edgeChallengeManagerABI = [ type: 'function', }, { - inputs: [ - { internalType: 'enum EdgeType', name: 'eType', type: 'uint8' }, - ], + inputs: [{ internalType: 'enum EdgeType', name: 'eType', type: 'uint8' }], name: 'getLayerZeroEndHeight', - outputs: [ - { internalType: 'uint256', name: '', type: 'uint256' }, - ], + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], stateMutability: 'view', type: 'function', }, { - inputs: [ - { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, - ], + inputs: [{ internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }], name: 'getPrevAssertionHash', - outputs: [ - { internalType: 'bytes32', name: '', type: 'bytes32' }, - ], + outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], stateMutability: 'view', type: 'function', }, { - inputs: [ - { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, - ], + inputs: [{ internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }], name: 'hasLengthOneRival', - outputs: [ - { internalType: 'bool', name: '', type: 'bool' }, - ], + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], stateMutability: 'view', type: 'function', }, @@ -648,20 +574,14 @@ export const edgeChallengeManagerABI = [ { internalType: 'bytes32', name: 'mutualId', type: 'bytes32' }, ], name: 'hasMadeLayerZeroRival', - outputs: [ - { internalType: 'bool', name: '', type: 'bool' }, - ], + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], stateMutability: 'view', type: 'function', }, { - inputs: [ - { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, - ], + inputs: [{ internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }], name: 'hasRival', - outputs: [ - { internalType: 'bool', name: '', type: 'bool' }, - ], + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], stateMutability: 'view', type: 'function', }, @@ -696,49 +616,35 @@ export const edgeChallengeManagerABI = [ { inputs: [], name: 'oneStepProofEntry', - outputs: [ - { internalType: 'contract IOneStepProofEntry', name: '', type: 'address' }, - ], + outputs: [{ internalType: 'contract IOneStepProofEntry', name: '', type: 'address' }], stateMutability: 'view', type: 'function', }, { - inputs: [ - { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, - ], + inputs: [{ internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }], name: 'refundStake', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { - inputs: [ - { internalType: 'uint256', name: '', type: 'uint256' }, - ], + inputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], name: 'stakeAmounts', - outputs: [ - { internalType: 'uint256', name: '', type: 'uint256' }, - ], + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], stateMutability: 'view', type: 'function', }, { inputs: [], name: 'stakeToken', - outputs: [ - { internalType: 'contract IERC20', name: '', type: 'address' }, - ], + outputs: [{ internalType: 'contract IERC20', name: '', type: 'address' }], stateMutability: 'view', type: 'function', }, { - inputs: [ - { internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }, - ], + inputs: [{ internalType: 'bytes32', name: 'edgeId', type: 'bytes32' }], name: 'timeUnrivaled', - outputs: [ - { internalType: 'uint256', name: '', type: 'uint256' }, - ], + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], stateMutability: 'view', type: 'function', },