Skip to main content

Module ITIP20ChannelReserve

Module ITIP20ChannelReserve 

Expand description

TIP-20 channel reserve ABI.

The reserve locks payer deposits, verifies EIP-712 cumulative vouchers, pays the payee incrementally, and lets the payer withdraw the remaining balance after a close grace period.

interface ITIP20ChannelReserve {
    struct ChannelDescriptor { address payer; address payee; address operator; address token; bytes32 salt; address authorizedSigner; bytes32 expiringNonceHash; }
    struct ChannelState { uint96 settled; uint96 deposit; uint32 closeRequestedAt; }
    struct Channel { ChannelDescriptor descriptor; ChannelState state; }
    function CLOSE_GRACE_PERIOD() external view returns (uint64);
    function VOUCHER_TYPEHASH() external view returns (bytes32);
    function open(address payee, address operator, address token, uint96 deposit, bytes32 salt, address authorizedSigner) external returns (bytes32 channelId);
    function settle(ChannelDescriptor calldata descriptor, uint96 cumulativeAmount, bytes calldata signature) external;
    function topUp(ChannelDescriptor calldata descriptor, uint96 additionalDeposit) external;
    function close(ChannelDescriptor calldata descriptor, uint96 cumulativeAmount, uint96 captureAmount, bytes calldata signature) external;
    function requestClose(ChannelDescriptor calldata descriptor) external;
    function withdraw(ChannelDescriptor calldata descriptor) external;
    function getChannel(ChannelDescriptor calldata descriptor) external view returns (Channel memory);
    function getChannelState(bytes32 channelId) external view returns (ChannelState memory);
    function getChannelStatesBatch(bytes32[] calldata channelIds) external view returns (ChannelState[] memory);
    function computeChannelId(address payer, address payee, address operator, address token, bytes32 salt, address authorizedSigner, bytes32 expiringNonceHash) external view returns (bytes32);
    function getVoucherDigest(bytes32 channelId, uint96 cumulativeAmount) external view returns (bytes32);
    function domainSeparator() external view returns (bytes32);
    event ChannelOpened(bytes32 indexed channelId, address indexed payer, address indexed payee, address operator, address token, address authorizedSigner, bytes32 salt, bytes32 expiringNonceHash, uint96 deposit);
    event Settled(bytes32 indexed channelId, address indexed payer, address indexed payee, uint96 cumulativeAmount, uint96 deltaPaid, uint96 newSettled);
    event TopUp(bytes32 indexed channelId, address indexed payer, address indexed payee, uint96 additionalDeposit, uint96 newDeposit);
    event CloseRequested(bytes32 indexed channelId, address indexed payer, address indexed payee, uint256 closeGraceEnd);
    event ChannelClosed(bytes32 indexed channelId, address indexed payer, address indexed payee, uint96 settledToPayee, uint96 refundedToPayer);
    event CloseRequestCancelled(bytes32 indexed channelId, address indexed payer, address indexed payee);
    error ChannelAlreadyExists();
    error ChannelNotFound();
    error NotPayer();
    error NotPayeeOrOperator();
    error InvalidPayee();
    error ZeroDeposit();
    error ExpiringNonceHashNotSet();
    error InvalidSignature();
    error AmountExceedsDeposit();
    error AmountNotIncreasing();
    error CaptureAmountInvalid();
    error CloseNotReady();
    error DepositOverflow();
}

Modules§

abi
Contains dynamic ABI definitions for this contract.

Structs§

AmountExceedsDeposit
Voucher or capture amount exceeds the channel deposit. Custom error with signature AmountExceedsDeposit() and selector 0xbd0d7138.
AmountNotIncreasing
Settlement amount must be greater than the current settled amount. Custom error with signature AmountNotIncreasing() and selector 0x32d2c1a3.
CLOSE_GRACE_PERIODCall
Delay between payer requestClose and withdraw. Function with signature CLOSE_GRACE_PERIOD() and selector 0x956c8327.
CLOSE_GRACE_PERIODReturn
Delay between payer requestClose and withdraw. Container type for the return parameters of the CLOSE_GRACE_PERIOD() function.
CaptureAmountInvalid
Close capture is below settled amount or above voucher amount. Custom error with signature CaptureAmountInvalid() and selector 0xc91833a1.
Channel
Full descriptor plus current state.
ChannelAlreadyExists
Channel id already exists in persistent state or earlier in this transaction. Custom error with signature ChannelAlreadyExists() and selector 0x0ec0f149.
ChannelClosed
Emitted when a channel is deleted by payee close or payer withdraw. Event with signature ChannelClosed(bytes32,address,address,uint96,uint96) and selector 0x5613aed96d5bf39f928408dbe1d4143490b9bb5957eac2dd8e69b5dc4b2206e6.
ChannelDescriptor
Immutable channel identity supplied to all descriptor-based methods.
ChannelNotFound
Descriptor resolves to an empty channel slot. Custom error with signature ChannelNotFound() and selector 0x1e07dd94.
ChannelOpened
Emitted after a channel is opened and funded. Event with signature ChannelOpened(bytes32,address,address,address,address,address,bytes32,bytes32,uint96) and selector 0xdebaba36f0e9c7978f536fed432d9360b1f9646d7ca88531c34c3eae43f154a7.
ChannelState
Mutable channel state packed into one native storage slot.
CloseNotReady
Payer withdraw was attempted before the close grace period elapsed. Custom error with signature CloseNotReady() and selector 0x02b81e29.
CloseRequestCancelled
Emitted when top-up clears a pending close request. Event with signature CloseRequestCancelled(bytes32,address,address) and selector 0x6bbcbc59913c43e567847487b95410b0b65cf253531b1c6505b21f8359c838fe.
CloseRequested
Emitted when the payer starts the close grace timer. Event with signature CloseRequested(bytes32,address,address,uint256) and selector 0xf5a36fc00a96cbb9cf1f8f59299165e1d8ffffe94396d82904b4da524d16bbce.
DepositOverflow
Top-up would overflow the packed deposit. Custom error with signature DepositOverflow() and selector 0x1132981b.
ExpiringNonceHashNotSet
Handler did not seed the transaction-scoped open context hash. Custom error with signature ExpiringNonceHashNotSet() and selector 0x102f04a9.
ITIP20ChannelReserveInstance
A ITIP20ChannelReserve instance.
InvalidPayee
Payee is zero or a TIP-20-prefix address. Custom error with signature InvalidPayee() and selector 0xb387a238.
InvalidSignature
Voucher signature did not recover to the expected signer. Custom error with signature InvalidSignature() and selector 0x8baa579f.
NotPayeeOrOperator
Caller must be the descriptor payee or nonzero operator. Custom error with signature NotPayeeOrOperator() and selector 0x626a2a3d.
NotPayer
Caller must be the descriptor payer. Custom error with signature NotPayer() and selector 0x1435e357.
Settled
Emitted after voucher settlement pays a delta to the payee. Event with signature Settled(bytes32,address,address,uint96,uint96,uint96) and selector 0x11c4e4c79ad8802431b44c15047ed1ddb82fbfc1abd452c765f7ee3990df1399.
TopUp
Emitted after channel deposit changes or a close request is cancelled by top-up. Event with signature TopUp(bytes32,address,address,uint96,uint96) and selector 0x2a96f534665f3150977dd4c35d91373c74030288edbb3cf83c527dd25012364f.
VOUCHER_TYPEHASHCall
EIP-712 type hash for Voucher(bytes32 channelId,uint96 cumulativeAmount). Function with signature VOUCHER_TYPEHASH() and selector 0x94739e87.
VOUCHER_TYPEHASHReturn
EIP-712 type hash for Voucher(bytes32 channelId,uint96 cumulativeAmount). Container type for the return parameters of the VOUCHER_TYPEHASH() function.
ZeroDeposit
Initial deposit cannot be zero. Custom error with signature ZeroDeposit() and selector 0x56316e87.
closeCall
Closes the channel from the payee/operator side and refunds uncaptured deposit. Function with signature close((address,address,address,address,bytes32,address,bytes32),uint96,uint96,bytes) and selector 0x73b57f74.
closeReturn
Closes the channel from the payee/operator side and refunds uncaptured deposit. Container type for the return parameters of the close((address,address,address,address,bytes32,address,bytes32),uint96,uint96,bytes) function.
computeChannelIdCall
Computes the canonical channel id for a descriptor. Function with signature computeChannelId(address,address,address,address,bytes32,address,bytes32) and selector 0x185eeeac.
computeChannelIdReturn
Computes the canonical channel id for a descriptor. Container type for the return parameters of the computeChannelId(address,address,address,address,bytes32,address,bytes32) function.
domainSeparatorCall
Returns the EIP-712 domain separator for the current chain. Function with signature domainSeparator() and selector 0xf698da25.
domainSeparatorReturn
Returns the EIP-712 domain separator for the current chain. Container type for the return parameters of the domainSeparator() function.
getChannelCall
Returns the descriptor and state for a channel. Function with signature getChannel((address,address,address,address,bytes32,address,bytes32)) and selector 0xeef95313.
getChannelReturn
Returns the descriptor and state for a channel. Container type for the return parameters of the getChannel((address,address,address,address,bytes32,address,bytes32)) function.
getChannelStateCall
Returns the state for channelId, or the zero state when absent. Function with signature getChannelState(bytes32) and selector 0xd18da8b1.
getChannelStateReturn
Returns the state for channelId, or the zero state when absent. Container type for the return parameters of the getChannelState(bytes32) function.
getChannelStatesBatchCall
Returns states for channelIds in order. Function with signature getChannelStatesBatch(bytes32[]) and selector 0xd1f4cda2.
getChannelStatesBatchReturn
Returns states for channelIds in order. Container type for the return parameters of the getChannelStatesBatch(bytes32[]) function.
getVoucherDigestCall
Computes the EIP-712 digest signed by the payer or authorized signer. Function with signature getVoucherDigest(bytes32,uint96) and selector 0xf3b349e8.
getVoucherDigestReturn
Computes the EIP-712 digest signed by the payer or authorized signer. Container type for the return parameters of the getVoucherDigest(bytes32,uint96) function.
openCall
Opens a channel and pulls deposit TIP-20 units from msg.sender. Function with signature open(address,address,address,uint96,bytes32,address) and selector 0xedc53b00.
openReturn
Opens a channel and pulls deposit TIP-20 units from msg.sender. Container type for the return parameters of the open(address,address,address,uint96,bytes32,address) function.
requestCloseCall
Starts the payer withdrawal timer. Function with signature requestClose((address,address,address,address,bytes32,address,bytes32)) and selector 0x675402e5.
requestCloseReturn
Starts the payer withdrawal timer. Container type for the return parameters of the requestClose((address,address,address,address,bytes32,address,bytes32)) function.
settleCall
Pays the unsettled delta up to cumulativeAmount using a valid voucher. Function with signature settle((address,address,address,address,bytes32,address,bytes32),uint96,bytes) and selector 0x97fb5104.
settleReturn
Pays the unsettled delta up to cumulativeAmount using a valid voucher. Container type for the return parameters of the settle((address,address,address,address,bytes32,address,bytes32),uint96,bytes) function.
topUpCall
Adds deposit to a channel and cancels any pending close request. Function with signature topUp((address,address,address,address,bytes32,address,bytes32),uint96) and selector 0xdc48471e.
topUpReturn
Adds deposit to a channel and cancels any pending close request. Container type for the return parameters of the topUp((address,address,address,address,bytes32,address,bytes32),uint96) function.
withdrawCall
Withdraws the payer refund after the close grace period has elapsed. Function with signature withdraw((address,address,address,address,bytes32,address,bytes32)) and selector 0x41e2c664.
withdrawReturn
Withdraws the payer refund after the close grace period has elapsed. Container type for the return parameters of the withdraw((address,address,address,address,bytes32,address,bytes32)) function.

Enums§

ITIP20ChannelReserveCalls
Container for all the ITIP20ChannelReserve function calls.
ITIP20ChannelReserveErrors
Container for all the ITIP20ChannelReserve custom errors.
ITIP20ChannelReserveEvents
Container for all the ITIP20ChannelReserve events.

Functions§

new
Creates a new wrapper around an on-chain ITIP20ChannelReserve contract instance.