Skip to content

Commit

Permalink
Merge pull request #1625 from statechannels/feat/nitro-adjudicator-in…
Browse files Browse the repository at this point in the history
…terface

feat: add `INitroAdjudicator` interface
  • Loading branch information
geoknee authored Sep 1, 2023
2 parents 8e23451 + e0e063b commit e5c526a
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 2 deletions.
3 changes: 2 additions & 1 deletion nitro-protocol/contracts/NitroAdjudicator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ pragma experimental ABIEncoderV2;

import {ExitFormat as Outcome} from '@statechannels/exit-format/contracts/ExitFormat.sol';
import {NitroUtils} from './libraries/NitroUtils.sol';
import './interfaces/INitroAdjudicator.sol';
import './ForceMove.sol';
import './MultiAssetHolder.sol';

/**
* @dev The NitroAdjudicator contract extends MultiAssetHolder and ForceMove
*/
contract NitroAdjudicator is ForceMove, MultiAssetHolder {
contract NitroAdjudicator is INitroAdjudicator, ForceMove, MultiAssetHolder {
/**
* @notice Finalizes a channel according to the given candidate, and liquidates all assets for the channel.
* @dev Finalizes a channel according to the given candidate, and liquidates all assets for the channel.
Expand Down
48 changes: 48 additions & 0 deletions nitro-protocol/contracts/interfaces/INitroAdjudicator.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
pragma experimental ABIEncoderV2;

import './IMultiAssetHolder.sol';
import './IForceMove.sol';

/**
* @dev The INitroAdjudicator defines an interface for a contract that adjudicates state channels. It is based on IMultiAssetHolder and IForceMove, extending them with some functions.
*/
interface INitroAdjudicator is IMultiAssetHolder, IForceMove {
/**
* @notice Finalizes a channel according to the given candidate, and liquidates all assets for the channel.
* @dev Finalizes a channel according to the given candidate, and liquidates all assets for the channel.
* @param fixedPart Data describing properties of the state channel that do not change with state updates.
* @param candidate Variable part of the state to change to.
*/
function concludeAndTransferAllAssets(
FixedPart memory fixedPart,
SignedVariablePart memory candidate
) external;

/**
* @notice Liquidates all assets for the channel
* @dev Liquidates all assets for the channel
* @param channelId Unique identifier for a state channel
* @param outcome An array of SingleAssetExit[] items.
* @param stateHash stored state hash for the channel
*/
function transferAllAssets(
bytes32 channelId,
Outcome.SingleAssetExit[] memory outcome,
bytes32 stateHash
) external;

/**
* @notice Checks whether an application-specific rules for a particular ForceMove-compliant state channel are enforced in supplied states.
* @dev Checks whether an application-specific rules for a particular ForceMove-compliant state channel are enforced in supplied states.
* @param fixedPart Fixed part of the state channel.
* @param proof Variable parts of the states with signatures in the support proof. The proof is a validation for the supplied candidate.
* @param candidate Variable part of the state to change to. The candidate state is supported by proof states.
*/
function stateIsSupported(
FixedPart calldata fixedPart,
SignedVariablePart[] calldata proof,
SignedVariablePart calldata candidate
) external view returns (bool, string memory);
}
Loading

0 comments on commit e5c526a

Please sign in to comment.