TESTAssetHolder.sol

View Source: contracts/test/TESTAssetHolder.sol

โ†— Extends: AssetHolder โ†˜ Derived Contracts: TESTAssetHolder2

This contract extends the AssetHolder contract to enable it to be more easily unit-tested. It exposes public or external functions that set storage variables or wrap otherwise internal functions. It should not be deployed in a production environment.


Functions


constructor

Constructor function storing the AdjudicatorAddress.

constructor(address _AdjudicatorAddress) public nonpayable

Arguments

NameTypeDescription
_AdjudicatorAddressaddressAddress of an Adjudicator contract, supplied at deploy-time.

setHoldings

Manually set the holdings mapping to a given amount for a given channelId. Shortcuts the deposit workflow (ONLY USE IN A TESTING ENVIRONMENT)

function setHoldings(bytes32 channelId, uint256 amount) external nonpayable

Arguments

NameTypeDescription
channelIdbytes32Unique identifier for a state channel.
amountuint256The number of assets that should now be "escrowed: against channelId

setAssetOutcomeHashPermissionless

Sets the given assetOutcomeHash for the given channelId in the assetOutcomeHashes storage mapping, but circumvents the AdjudicatorOnly modifier (thereby allowing externally owned accounts to call the method).

function setAssetOutcomeHashPermissionless(bytes32 channelId, bytes32 assetOutcomeHash) external nonpayable
returns(success bool)

Arguments

NameTypeDescription
channelIdbytes32Unique identifier for a state channel.
assetOutcomeHashbytes32The keccak256 of the abi.encode of the Outcome.

transferAllAdjudicatorOnly

Transfers the funds escrowed against channelId to the beneficiaries of that channel. No checks performed against storage in this contract. Permissions have been bypassed for testing purposes.

function transferAllAdjudicatorOnly(bytes32 channelId, bytes allocationBytes) external nonpayable

Arguments

NameTypeDescription
channelIdbytes32Unique identifier for a state channel.
allocationBytesbytesThe abi.encode of AssetOutcome.Allocation

isExternalDestination

Wrapper for otherwise internal function. Checks if a given destination is external (and can therefore have assets transferred to it) or not.

function isExternalDestination(bytes32 destination) public pure
returns(bool)

Returns

True if the destination is external, false otherwise.

Arguments

NameTypeDescription
destinationbytes32Destination to be checked.

addressToBytes32

Wrapper for otherwise internal function. Converts an ethereum address to a nitro external destination.

function addressToBytes32(address participant) public pure
returns(bytes32)

Returns

The input address left-padded with zeros.

Arguments

NameTypeDescription
participantaddressThe address to be converted.
Last updated on by geoknee