ERC20AssetHolder.sol

View Source: contracts/ERC20AssetHolder.sol

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

Ther ERC20AssetHolder contract extends the AssetHolder contract, and adds the following functionality: it allows ERC20 tokens to be escrowed against a state channelId and to be transferred to external destinations.


Contract Members

Constants & Variables

contract IERC20 public Token;

Functions


constructor

Constructor function storing the AdjudicatorAddress and instantiating an interface to an ERC20 Token contract.

constructor(address _AdjudicatorAddress, address _TokenAddress) public nonpayable

Arguments

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

deposit

Deposit ERC20 tokens against a given destination.

function deposit(bytes32 destination, uint256 expectedHeld, uint256 amount) public nonpayable

Arguments

NameTypeDescription
destinationbytes32ChannelId to be credited.
expectedHelduint256The amount of tokens that the depositor believes are already escrowed against the channelId.
amountuint256The intended number of tokens to be deposited.

_transferAsset

Transfers the given amount of ERC20 tokens to a supplied ethereum address.

function _transferAsset(address payable destination, uint256 amount) internal nonpayable

Arguments

NameTypeDescription
destinationaddress payableEthereum address to be credited.
amountuint256Quantity of tokens to be transferred.
Last updated on by geoknee