Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: Change Operator event names in LSP7 and LSP8 #809

Merged
merged 3 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions contracts/LSP7DigitalAsset/ILSP7DigitalAsset.sol
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ interface ILSP7DigitalAsset is IERC165, IERC725Y {
* @param amount The amount of tokens `operator` address has access to from `tokenOwner`
* @param operatorNotificationData The data to notify the operator about via LSP1.
*/
event AuthorizedOperator(
event OperatorAuthorizationChanged(
address indexed operator,
address indexed tokenOwner,
uint256 indexed amount,
Expand All @@ -53,10 +53,10 @@ interface ILSP7DigitalAsset is IERC165, IERC725Y {
* @param notified Bool indicating whether the operator has been notified or not
* @param operatorNotificationData The data to notify the operator about via LSP1.
*/
event RevokedOperator(
event OperatorRevoked(
address indexed operator,
address indexed tokenOwner,
bool notified,
bool indexed notified,
bytes operatorNotificationData
);

Expand Down Expand Up @@ -112,7 +112,7 @@ interface ILSP7DigitalAsset is IERC165, IERC725Y {
* @custom:requirements
* - `operator` cannot be the zero address.
*
* @custom:events {AuthorizedOperator} when allowance is given to a new operator or
* @custom:events {OperatorAuthorizationChanged} when allowance is given to a new operator or
* an existing operator's allowance is updated.
*/
function authorizeOperator(
Expand All @@ -133,7 +133,7 @@ interface ILSP7DigitalAsset is IERC165, IERC725Y {
* - `operator` cannot be calling address.
* - `operator` cannot be the zero address.
*
* @custom:events {RevokedOperator} event with address of the operator being revoked for the caller (token holder).
* @custom:events {OperatorRevoked} event with address of the operator being revoked for the caller (token holder).
*/
function revokeOperator(
address operator,
Expand All @@ -159,7 +159,7 @@ interface ILSP7DigitalAsset is IERC165, IERC725Y {
* - `operator` cannot be the same address as `msg.sender`
* - `operator` cannot be the zero address.
*
* @custom:events {AuthorizedOperator} indicating the updated allowance
* @custom:events {OperatorAuthorizationChanged} indicating the updated allowance
*/
function increaseAllowance(
address operator,
Expand All @@ -179,8 +179,8 @@ interface ILSP7DigitalAsset is IERC165, IERC725Y {
* Notify the operator based on the LSP1-UniversalReceiver standard
*
* @custom:events
* - {AuthorizedOperator} event indicating the updated allowance after decreasing it.
* - {RevokeOperator} event if `subtractedAmount` is the full allowance,
* - {OperatorAuthorizationChanged} event indicating the updated allowance after decreasing it.
* - {OperatorRevoked} event if `subtractedAmount` is the full allowance,
* indicating `operator` does not have any alauthorizedAmountForlowance left for `msg.sender`.
*
* @param operator The operator to decrease allowance for `msg.sender`
Expand Down Expand Up @@ -245,7 +245,7 @@ interface ILSP7DigitalAsset is IERC165, IERC725Y {
*
* @custom:events
* - {Transfer} event when tokens get successfully transferred.
* - if the transfer is triggered by an operator, either the {AuthorizedOperator} event will be emitted with the updated allowance or the {RevokedOperator}
* - if the transfer is triggered by an operator, either the {OperatorAuthorizationChanged} event will be emitted with the updated allowance or the {OperatorRevoked}
* event will be emitted if the operator has no more allowance left.
*
* @custom:hint The `force` parameter **MUST be set to `true`** to transfer tokens to Externally Owned Accounts (EOAs)
Expand Down
12 changes: 6 additions & 6 deletions contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ abstract contract LSP7DigitalAssetCore is ILSP7DigitalAsset {
* @param operatorNotificationData The data to send to the universalReceiver function of the operator in case of notifying
*
* @custom:events
* - {RevokedOperator} event when operator's allowance is set to `0`.
* - {AuthorizedOperator} event when operator's allowance is set to any other amount.
* - {OperatorRevoked} event when operator's allowance is set to `0`.
* - {OperatorAuthorizationChanged} event when operator's allowance is set to any other amount.
*
* @custom:requirements
* - `operator` cannot be the zero address.
Expand All @@ -341,15 +341,15 @@ abstract contract LSP7DigitalAssetCore is ILSP7DigitalAsset {

if (allowance != 0) {
_operators[tokenOwner].add(operator);
emit AuthorizedOperator(
emit OperatorAuthorizationChanged(
operator,
tokenOwner,
allowance,
operatorNotificationData
);
} else {
_operators[tokenOwner].remove(operator);
emit RevokedOperator(
emit OperatorRevoked(
operator,
tokenOwner,
notified,
Expand Down Expand Up @@ -482,8 +482,8 @@ abstract contract LSP7DigitalAssetCore is ILSP7DigitalAsset {
* @param amountToSpend The amount of tokens to substract in allowance of `operator`.
*
* @custom:events
* - {RevokedOperator} event when operator's allowance is set to `0`.
* - {AuthorizedOperator} event when operator's allowance is set to any other amount.
* - {OperatorRevoked} event when operator's allowance is set to `0`.
* - {OperatorAuthorizationChanged} event when operator's allowance is set to any other amount.
*
* @custom:requirements
* - The `amountToSpend` MUST be at least the allowance granted to `operator` (accessible via {`authorizedAmountFor}`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ interface ILSP8IdentifiableDigitalAsset is IERC165, IERC725Y {
* @param tokenId The tokenId `operator` address has access on behalf of `tokenOwner`.
* @param operatorNotificationData The data to notify the operator about via LSP1.
*/
event AuthorizedOperator(
event OperatorAuthorizationChanged(
address indexed operator,
address indexed tokenOwner,
bytes32 indexed tokenId,
Expand All @@ -54,7 +54,7 @@ interface ILSP8IdentifiableDigitalAsset is IERC165, IERC725Y {
* @param notified Bool indicating whether the operator has been notified or not
* @param operatorNotificationData The data to notify the operator about via LSP1.
*/
event RevokedOperator(
event OperatorRevoked(
address indexed operator,
address indexed tokenOwner,
bytes32 indexed tokenId,
Expand Down Expand Up @@ -116,7 +116,7 @@ interface ILSP8IdentifiableDigitalAsset is IERC165, IERC725Y {
* - the owner of a `tokenId` cannot grant itself as an `operator` (`operator` cannot be the calling address).
* - `operator` cannot be the zero address.
*
* @custom:events {AuthorizedOperator} event.
* @custom:events {OperatorAuthorizationChanged} event.
*/
function authorizeOperator(
address operator,
Expand All @@ -139,7 +139,7 @@ interface ILSP8IdentifiableDigitalAsset is IERC165, IERC725Y {
* - the owner of a `tokenId` cannot grant revoke itself as an `operator` (`operator` cannot be the calling address).
* - `operator` cannot be the zero address.
*
* @custom:events {RevokedOperator} event with address of the operator being revoked for the caller (token owner)..
* @custom:events {OperatorRevoked} event with address of the operator being revoked for the caller (token owner)..
*/
function revokeOperator(
address operator,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ abstract contract LSP8IdentifiableDigitalAssetCore is
bool isAdded = _operators[tokenId].add(operator);
if (!isAdded) revert LSP8OperatorAlreadyAuthorized(operator, tokenId);

emit AuthorizedOperator(
emit OperatorAuthorizationChanged(
operator,
tokenOwner,
tokenId,
Expand Down Expand Up @@ -296,7 +296,7 @@ abstract contract LSP8IdentifiableDigitalAssetCore is
bool isRemoved = _operators[tokenId].remove(operator);
if (!isRemoved) revert LSP8NonExistingOperator(operator, tokenId);

emit RevokedOperator(
emit OperatorRevoked(
operator,
tokenOwner,
tokenId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ abstract contract LSP8CompatibleERC721 is
* @inheritdoc LSP8IdentifiableDigitalAssetCore
*
* @custom:events
* - LSP7 {AuthorizedOperator} event.
* - LSP7 {OperatorAuthorizationChanged} event.
* - ERC721 {Approval} event.
*/
function authorizeOperator(
Expand Down Expand Up @@ -344,7 +344,7 @@ abstract contract LSP8CompatibleERC721 is
bool isAdded = _operators[tokenId].add(operator);
if (!isAdded) revert LSP8OperatorAlreadyAuthorized(operator, tokenId);

emit AuthorizedOperator(
emit OperatorAuthorizationChanged(
operator,
tokenOwner,
tokenId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ abstract contract LSP8CompatibleERC721InitAbstract is
* @inheritdoc LSP8IdentifiableDigitalAssetCore
*
* @custom:events
* - LSP7 {AuthorizedOperator} event.
* - LSP7 {OperatorAuthorizationChanged} event.
* - ERC721 {Approval} event.
*/
function authorizeOperator(
Expand Down Expand Up @@ -353,7 +353,7 @@ abstract contract LSP8CompatibleERC721InitAbstract is
bool isAdded = _operators[tokenId].add(operator);
if (!isAdded) revert LSP8OperatorAlreadyAuthorized(operator, tokenId);

emit AuthorizedOperator(
emit OperatorAuthorizationChanged(
operator,
tokenOwner,
tokenId,
Expand Down
86 changes: 43 additions & 43 deletions docs/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md
Original file line number Diff line number Diff line change
Expand Up @@ -1126,34 +1126,6 @@ CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of t

## Events

### AuthorizedOperator

:::note References

- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#authorizedoperator)
- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol)
- Event signature: `AuthorizedOperator(address,address,uint256,bytes)`
- Event topic hash: `0x0744b3de98efaff36606a0e67662fb8697adb0ed49d90730bdb4bbf885f30597`

:::

```solidity
event AuthorizedOperator(address indexed operator, address indexed tokenOwner, uint256 indexed amount, bytes operatorNotificationData);
```

Emitted when `tokenOwner` enables `operator` for `amount` tokens.

#### Parameters

| Name | Type | Description |
| -------------------------- | :-------: | ----------------------------------------------------------------------- |
| `operator` **`indexed`** | `address` | The address authorized as an operator |
| `tokenOwner` **`indexed`** | `address` | The token owner |
| `amount` **`indexed`** | `uint256` | The amount of tokens `operator` address has access to from `tokenOwner` |
| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |

<br/>

### DataChanged

:::note References
Expand Down Expand Up @@ -1182,43 +1154,47 @@ Emitted when data at a specific `dataKey` was changed to a new value `dataValue`

<br/>

### OwnershipTransferred
### OperatorAuthorizationChanged

:::note References

- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#ownershiptransferred)
- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#operatorauthorizationchanged)
- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol)
- Event signature: `OwnershipTransferred(address,address)`
- Event topic hash: `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0`
- Event signature: `OperatorAuthorizationChanged(address,address,uint256,bytes)`
- Event topic hash: `0xf772a43bfdf4729b196e3fb54a818b91a2ca6c49d10b2e16278752f9f515c25d`

:::

```solidity
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event OperatorAuthorizationChanged(address indexed operator, address indexed tokenOwner, uint256 indexed amount, bytes operatorNotificationData);
```

Emitted when `tokenOwner` enables `operator` for `amount` tokens.

#### Parameters

| Name | Type | Description |
| ----------------------------- | :-------: | ----------- |
| `previousOwner` **`indexed`** | `address` | - |
| `newOwner` **`indexed`** | `address` | - |
| Name | Type | Description |
| -------------------------- | :-------: | ----------------------------------------------------------------------- |
| `operator` **`indexed`** | `address` | The address authorized as an operator |
| `tokenOwner` **`indexed`** | `address` | The token owner |
| `amount` **`indexed`** | `uint256` | The amount of tokens `operator` address has access to from `tokenOwner` |
| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |

<br/>

### RevokedOperator
### OperatorRevoked

:::note References

- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#revokedoperator)
- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#operatorrevoked)
- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol)
- Event signature: `RevokedOperator(address,address,bool,bytes)`
- Event topic hash: `0x66015c8835ee443e5bc280176609215a5035da4bae05bdef994596d7e43aae22`
- Event signature: `OperatorRevoked(address,address,bool,bytes)`
- Event topic hash: `0x0ebf5762d8855cbe012d2ca42fb33a81175e17c8a8751f8859931ba453bd4167`

:::

```solidity
event RevokedOperator(address indexed operator, address indexed tokenOwner, bool notified, bytes operatorNotificationData);
event OperatorRevoked(address indexed operator, address indexed tokenOwner, bool indexed notified, bytes operatorNotificationData);
```

Emitted when `tokenOwner` disables `operator` for `amount` tokens and set its [`authorizedAmountFor(...)`](#`authorizedamountfor) to `0`.
Expand All @@ -1229,11 +1205,35 @@ Emitted when `tokenOwner` disables `operator` for `amount` tokens and set its [`
| -------------------------- | :-------: | ------------------------------------------------------------- |
| `operator` **`indexed`** | `address` | The address revoked from operating |
| `tokenOwner` **`indexed`** | `address` | The token owner |
| `notified` | `bool` | Bool indicating whether the operator has been notified or not |
| `notified` **`indexed`** | `bool` | Bool indicating whether the operator has been notified or not |
| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |

<br/>

### OwnershipTransferred

:::note References

- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#ownershiptransferred)
- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol)
- Event signature: `OwnershipTransferred(address,address)`
- Event topic hash: `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0`

:::

```solidity
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
```

#### Parameters

| Name | Type | Description |
| ----------------------------- | :-------: | ----------- |
| `previousOwner` **`indexed`** | `address` | - |
| `newOwner` **`indexed`** | `address` | - |

<br/>

### Transfer

:::note References
Expand Down
Loading
Loading