Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add INitroAdjudicator interface #1625

Merged
merged 2 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading