IMultiAssetHolder.sol

View Source: contracts/interfaces/IMultiAssetHolder.sol

โ†˜ Derived Contracts: MultiAssetHolder

The IMultiAssetHolder interface calls for functions that allow assets to be transferred from one channel to other channel and/or external destinations, as well as for guarantees to be claimed.


Structs

ClaimArgs

struct ClaimArgs {
bytes32 sourceChannelId,
bytes32 sourceStateHash,
bytes sourceOutcomeBytes,
uint256 sourceAssetIndex,
uint256 indexOfTargetInSource,
bytes32 targetStateHash,
bytes targetOutcomeBytes,
uint256 targetAssetIndex,
uint256[] targetAllocationIndicesToPayout
}

Events

event Deposited(bytes32 indexed destination, address asset, uint256 amountDeposited, uint256 destinationHoldings);
event AllocationUpdated(bytes32 indexed channelId, uint256 assetIndex, uint256 initialHoldings);

Functions


deposit

Deposit ETH or erc20 assets against a given destination.

function deposit(address asset, bytes32 destination, uint256 expectedHeld, uint256 amount) external payable

Arguments

NameTypeDescription
assetaddresserc20 token address, or zero address to indicate ETH
destinationbytes32ChannelId to be credited.
expectedHelduint256The number of wei the depositor believes are already escrowed against the channelId.
amountuint256The intended number of wei to be deposited.

transfer

Transfers as many funds escrowed against channelId as can be afforded for a specific destination. Assumes no repeated entries.

function transfer(uint256 assetIndex, bytes32 fromChannelId, bytes outcomeBytes, bytes32 stateHash, uint256[] indices) external nonpayable

Arguments

NameTypeDescription
assetIndexuint256Will be used to slice the outcome into a single asset outcome.
fromChannelIdbytes32Unique identifier for state channel to transfer funds from.
outcomeBytesbytesThe encoded Outcome of this state channel
stateHashbytes32The hash of the state stored when the channel finalized.
indicesuint256[]Array with each entry denoting the index of a destination to transfer funds to. An empty array indicates "all".

claim

Transfers as many funds escrowed against sourceChannelId as can be afforded for the destinations specified by indices in the beneficiaries of the target of the channel at indexOfTargetInSource.

function claim(struct IMultiAssetHolder.ClaimArgs claimArgs) external nonpayable

Arguments

NameTypeDescription
claimArgsstruct IMultiAssetHolder.ClaimArgsarguments used in the claim function. Used to avoid stack too deep error.