@@ -50,11 +50,13 @@ interface ILSP7DigitalAsset is IERC165, IERC725Y {
50
50
* @dev Emitted when `tokenOwner` disables `operator` for `amount` tokens and set its {`authorizedAmountFor(...)`} to `0`.
51
51
* @param operator The address revoked from operating
52
52
* @param tokenOwner The token owner
53
+ * @param notified Bool indicating whether the operator has been notified or not
53
54
* @param operatorNotificationData The data to notify the operator about via LSP1.
54
55
*/
55
56
event RevokedOperator (
56
57
address indexed operator ,
57
58
address indexed tokenOwner ,
59
+ bool notified ,
58
60
bytes operatorNotificationData
59
61
);
60
62
@@ -101,6 +103,7 @@ interface ILSP7DigitalAsset is IERC165, IERC725Y {
101
103
102
104
/**
103
105
* @dev Sets an `amount` of tokens that an `operator` has access from the caller's balance (allowance). See {authorizedAmountFor}.
106
+ * Notify the operator based on the LSP1-UniversalReceiver standard
104
107
*
105
108
* @param operator The address to authorize as an operator.
106
109
* @param amount The allowance amount of tokens operator has access to.
@@ -123,6 +126,7 @@ interface ILSP7DigitalAsset is IERC165, IERC725Y {
123
126
* on behalf of the token owner (the caller of the function `msg.sender`). See also {authorizedAmountFor}.
124
127
*
125
128
* @param operator The address to revoke as an operator.
129
+ * @param notify Boolean indicating whether to notify the operator or not
126
130
* @param operatorNotificationData The data to notify the operator about via LSP1.
127
131
*
128
132
* @custom:requirements
@@ -133,6 +137,62 @@ interface ILSP7DigitalAsset is IERC165, IERC725Y {
133
137
*/
134
138
function revokeOperator (
135
139
address operator ,
140
+ bool notify ,
141
+ bytes memory operatorNotificationData
142
+ ) external ;
143
+
144
+ /**
145
+ * @custom:info This function in the LSP7 contract can be used as a prevention mechanism
146
+ * against double spending allowance vulnerability.
147
+ *
148
+ * @notice Increase the allowance of `operator` by +`addedAmount`
149
+ *
150
+ * @dev Atomically increases the allowance granted to `operator` by the caller.
151
+ * This is an alternative approach to {authorizeOperator} that can be used as a mitigation
152
+ * for the double spending allowance problem.
153
+ * Notify the operator based on the LSP1-UniversalReceiver standard
154
+ *
155
+ * @param operator The operator to increase the allowance for `msg.sender`
156
+ * @param addedAmount The additional amount to add on top of the current operator's allowance
157
+ *
158
+ * @custom:requirements
159
+ * - `operator` cannot be the same address as `msg.sender`
160
+ * - `operator` cannot be the zero address.
161
+ *
162
+ * @custom:events {AuthorizedOperator} indicating the updated allowance
163
+ */
164
+ function increaseAllowance (
165
+ address operator ,
166
+ uint256 addedAmount ,
167
+ bytes memory operatorNotificationData
168
+ ) external ;
169
+
170
+ /**
171
+ * @custom:info This function in the LSP7 contract can be used as a prevention mechanism
172
+ * against the double spending allowance vulnerability.
173
+ *
174
+ * @notice Decrease the allowance of `operator` by -`subtractedAmount`
175
+ *
176
+ * @dev Atomically decreases the allowance granted to `operator` by the caller.
177
+ * This is an alternative approach to {authorizeOperator} that can be used as a mitigation
178
+ * for the double spending allowance problem.
179
+ * Notify the operator based on the LSP1-UniversalReceiver standard
180
+ *
181
+ * @custom:events
182
+ * - {AuthorizedOperator} event indicating the updated allowance after decreasing it.
183
+ * - {RevokeOperator} event if `subtractedAmount` is the full allowance,
184
+ * indicating `operator` does not have any alauthorizedAmountForlowance left for `msg.sender`.
185
+ *
186
+ * @param operator The operator to decrease allowance for `msg.sender`
187
+ * @param subtractedAmount The amount to decrease by in the operator's allowance.
188
+ *
189
+ * @custom:requirements
190
+ * - `operator` cannot be the zero address.
191
+ * - `operator` must have allowance for the caller of at least `subtractedAmount`.
192
+ */
193
+ function decreaseAllowance (
194
+ address operator ,
195
+ uint256 subtractedAmount ,
136
196
bytes memory operatorNotificationData
137
197
) external ;
138
198
0 commit comments