-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathITempoStreamChannel.sol
More file actions
107 lines (86 loc) · 3.29 KB
/
ITempoStreamChannel.sol
File metadata and controls
107 lines (86 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.20 <0.9.0;
/// @title ITempoStreamChannel
/// @notice Interface for the TempoStreamChannel escrow contract.
/// @dev Unidirectional payment channel for streaming payments using EIP-712 signed vouchers.
/// Spec: https://paymentauth.tempo.xyz/draft-tempo-stream-00
interface ITempoStreamChannel {
struct Channel {
bool finalized;
uint64 closeRequestedAt;
address payer;
address payee;
address token;
address authorizedSigner;
uint128 deposit;
uint128 settled;
}
function CLOSE_GRACE_PERIOD() external view returns (uint64);
function VOUCHER_TYPEHASH() external view returns (bytes32);
function open(address payee, address token, uint128 deposit, bytes32 salt, address authorizedSigner)
external
returns (bytes32 channelId);
function settle(bytes32 channelId, uint128 cumulativeAmount, bytes calldata signature) external;
function topUp(bytes32 channelId, uint256 additionalDeposit) external;
function close(bytes32 channelId, uint128 cumulativeAmount, bytes calldata signature) external;
function requestClose(bytes32 channelId) external;
function withdraw(bytes32 channelId) external;
function getChannel(bytes32 channelId) external view returns (Channel memory);
function getChannelsBatch(bytes32[] calldata channelIds) external view returns (Channel[] memory);
function computeChannelId(address payer, address payee, address token, bytes32 salt, address authorizedSigner)
external
view
returns (bytes32);
function getVoucherDigest(bytes32 channelId, uint128 cumulativeAmount) external view returns (bytes32);
function domainSeparator() external view returns (bytes32);
event ChannelOpened(
bytes32 indexed channelId,
address indexed payer,
address indexed payee,
address token,
address authorizedSigner,
bytes32 salt,
uint256 deposit
);
event Settled(
bytes32 indexed channelId,
address indexed payer,
address indexed payee,
uint256 cumulativeAmount,
uint256 deltaPaid,
uint256 newSettled
);
event CloseRequested(
bytes32 indexed channelId, address indexed payer, address indexed payee, uint256 closeGraceEnd
);
event TopUp(
bytes32 indexed channelId,
address indexed payer,
address indexed payee,
uint256 additionalDeposit,
uint256 newDeposit
);
event ChannelClosed(
bytes32 indexed channelId,
address indexed payer,
address indexed payee,
uint256 settledToPayee,
uint256 refundedToPayer
);
event CloseRequestCancelled(bytes32 indexed channelId, address indexed payer, address indexed payee);
event ChannelExpired(bytes32 indexed channelId, address indexed payer, address indexed payee);
error ChannelAlreadyExists();
error ChannelNotFound();
error ChannelFinalized();
error InvalidSignature();
error AmountExceedsDeposit();
error AmountNotIncreasing();
error NotPayer();
error NotPayee();
error TransferFailed();
error CloseNotReady();
error InvalidPayee();
error InvalidToken();
error ZeroDeposit();
error DepositOverflow();
}