NitroAdjudicator.sol

View Source: contracts/NitroAdjudicator.sol

โ†— Extends: Adjudicator, ForceMove โ†˜ Derived Contracts: TESTNitroAdjudicator

The NitroAdjudicator contract extends ForceMove and hence inherits all ForceMove methods, and also extends and implements the Adjudicator interface, allowing for a finalized outcome to be pushed to an asset holder.


Functions


pushOutcome

Allows a finalized channel's outcome to be decoded and one or more AssetOutcomes registered in external Asset Holder contracts.

function pushOutcome(bytes32 channelId, uint48 turnNumRecord, uint48 finalizesAt, bytes32 stateHash, address challengerAddress, bytes outcomeBytes) public nonpayable

Arguments

NameTypeDescription
channelIdbytes32Unique identifier for a state channel
turnNumRecorduint48A turnNum that (the adjudicator knows and stores) is supported by a signature from each participant.
finalizesAtuint48The unix timestamp when this channel will finalize
stateHashbytes32The keccak256 of the abi.encode of the State (struct) stored by the adjudicator
challengerAddressaddressThe address of the participant whom registered the challenge, if any.
outcomeBytesbytesThe encoded Outcome of this state channel.

pushOutcomeAndTransferAll

Allows a finalized channel's outcome to be decoded and transferAll to be triggered in external Asset Holder contracts.

function pushOutcomeAndTransferAll(bytes32 channelId, uint48 turnNumRecord, uint48 finalizesAt, bytes32 stateHash, address challengerAddress, bytes outcomeBytes) public nonpayable

Arguments

NameTypeDescription
channelIdbytes32Unique identifier for a state channel
turnNumRecorduint48A turnNum that (the adjudicator knows and stores) is supported by a signature from each participant.
finalizesAtuint48The unix timestamp when this channel will finalize
stateHashbytes32The keccak256 of the abi.encode of the State (struct) stored by the adjudicator
challengerAddressaddressThe address of the participant whom registered the challenge, if any.
outcomeBytesbytesThe encoded Outcome of this state channel.

concludePushOutcomeAndTransferAll

Finalizes a channel by providing a finalization proof, allows a finalized channel's outcome to be decoded and transferAll to be triggered in external Asset Holder contracts.

function concludePushOutcomeAndTransferAll(uint48 largestTurnNum, struct IForceMove.FixedPart fixedPart, bytes32 appPartHash, bytes outcomeBytes, uint8 numStates, uint8[] whoSignedWhat, struct IForceMove.Signature[] sigs) public nonpayable

Arguments

NameTypeDescription
largestTurnNumuint48The largest turn number of the submitted states; will overwrite the stored value of turnNumRecord.
fixedPartstruct IForceMove.FixedPartData describing properties of the state channel that do not change with state updates.
appPartHashbytes32The keccak256 of the abi.encode of (challengeDuration, appDefinition, appData). Applies to all states in the finalization proof.
outcomeBytesbytesabi.encode of an array of Outcome.OutcomeItem structs.
numStatesuint8The number of states in the finalization proof.
whoSignedWhatuint8[]An array denoting which participant has signed which state: participant[i] signed the state with index whoSignedWhat[i].
sigsstruct IForceMove.Signature[]An array of signatures that support the state with the largestTurnNum.

_transferAllFromAllAssetHolders

Triggers transferAll in all external Asset Holder contracts specified in a given outcome for a given channelId.

function _transferAllFromAllAssetHolders(bytes32 channelId, bytes outcomeBytes) internal nonpayable

Arguments

NameTypeDescription
channelIdbytes32Unique identifier for a state channel
outcomeBytesbytesabi.encode of an array of Outcome.OutcomeItem structs.

validTransition

Check that the submitted pair of states form a valid transition (public wrapper for internal function _requireValidTransition)

function validTransition(uint256 nParticipants, bool[2] isFinalAB, struct ForceMoveApp.VariablePart[2] ab, uint48 turnNumB, address appDefinition) public pure
returns(bool)

Returns

true if the later state is a validTransition from its predecessor, reverts otherwise.

Arguments

NameTypeDescription
nParticipantsuint256Number of participants in the channel.
transition
isFinalABbool[2]Pair of booleans denoting whether the first and second state (resp.) are final.
abstruct ForceMoveApp.VariablePart[2]Variable parts of each of the pair of states
turnNumBuint48turnNum of the later state of the pair.
appDefinitionaddressAddress of deployed contract containing application-specific validTransition function.
Last updated on by geoknee