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
Name | Type | Description |
---|---|---|
asset | address | erc20 token address, or zero address to indicate ETH |
destination | bytes32 | ChannelId to be credited. |
expectedHeld | uint256 | The number of wei the depositor believes are already escrowed against the channelId. |
amount | uint256 | The 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
Name | Type | Description |
---|---|---|
assetIndex | uint256 | Will be used to slice the outcome into a single asset outcome. |
fromChannelId | bytes32 | Unique identifier for state channel to transfer funds from. |
outcomeBytes | bytes | The encoded Outcome of this state channel |
stateHash | bytes32 | The hash of the state stored when the channel finalized. |
indices | uint256[] | 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
Name | Type | Description |
---|---|---|
claimArgs | struct IMultiAssetHolder.ClaimArgs | arguments used in the claim function. Used to avoid stack too deep error. |