Skip to content

Commit

Permalink
feat: add new func and events
Browse files Browse the repository at this point in the history
  • Loading branch information
redhdx committed Jan 16, 2025
1 parent 1fd89ea commit 4b0ab33
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/contracts-bedrock/src/dispute/ZkFaultDisputeGame.sol
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,7 @@ contract ZkFaultDisputeGame is IZkFaultDisputeGame, Clone, ISemver {
challengedClaimsTimestamp[_disputeClaimIndex] = uint64(block.timestamp);
challengers[_disputeClaimIndex] = payable(msg.sender);
challengedClaimIndexes.push(_disputeClaimIndex);
// todo event
// get challengedClaimIndexes length
/// @notice Returns the length of the `claimData` array.
// function claimDataLen() external view returns (uint256 len_) {
// len_ = claimData.length;
// }
emit ChallengeBySignalCreated(_disputeClaimIndex);
}

function submitProofForSignal(uint256 _disputeClaimIndex, Claim[] calldata _originalClaims, bytes calldata _proof) external override {
Expand Down Expand Up @@ -345,7 +340,7 @@ contract ZkFaultDisputeGame is IZkFaultDisputeGame, Clone, ISemver {
validityProofProvers[_disputeClaimIndex] = payable(msg.sender);
invalidChallengeClaims[_disputeClaimIndex] = true;
invalidChallengeClaimIndexes.push(_disputeClaimIndex);
// todo event
emit SubmitProofForSignalCreated(_disputeClaimIndex);
}

function resolveClaim() external override {
Expand Down Expand Up @@ -609,6 +604,11 @@ contract ZkFaultDisputeGame is IZkFaultDisputeGame, Clone, ISemver {
}
}

/// @notice Returns the length of the `challengedClaimIndexes` array.
function challengedClaimIndexesLen() external view returns (uint256 len_) {
len_ = challengedClaimIndexes.length;
}

/// @notice Returns the parent game status
/// if the parent game is 0x00...00, then the parent game is from anchor state registry
/// and its status is always DEFENDER_WINS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ import "src/dispute/lib/Types.sol";
/// @notice The interface for a zk fault proof backed dispute game.
interface IZkFaultDisputeGame is IDisputeGame {

/// @notice Emitted when a new ChallengeBySignal is created
/// @param _disputeClaimIndex The index of the dispute claim
event ChallengeBySignalCreated(uint256 indexed _disputeClaimIndex);

// @notice Emitted when a new SubmitProofForSignal is created
/// @param _disputeClaimIndex The index of the dispute claim
event SubmitProofForSignalCreated(uint256 indexed _disputeClaimIndex);

/// @notice Parameters to initialize the contract.
struct InitParams {
uint256 chainId;
Expand Down

0 comments on commit 4b0ab33

Please sign in to comment.