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

Log events #700

Merged
merged 10 commits into from
Sep 20, 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
5 changes: 5 additions & 0 deletions docs/developers/event-logs/contract-call-events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
id: contract-call-events
title: Smart Contract Call Events
---

5 changes: 5 additions & 0 deletions docs/developers/event-logs/contract-deploy-events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
id: contract-deploy-events
title: Smart Contract Deploy Events
---

231 changes: 231 additions & 0 deletions docs/developers/event-logs/esdt-events.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
---
id: esdt-events
title: ESDT Operations Events
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';


ESDT Operations Events are generated in response to interactions with an ESDT token.
These events help keep track of actions like creating new tokens, transferring tokens between addresses, burning tokens, etc.


### Fungible token transfer

The `ESDTTransfer` event is emitted when a fungible token undergoes a transfer operation via the `ESDTTransfer` built-in function.
<Tabs
defaultValue="Structure"
values={[
{label: 'Structure', value: 'Structure'},
{label: 'Example', value: 'Example'},
]}
>
<TabItem value="Structure">

| Field | Value |
|------------|------------------------------------------------------------------------------------------------------------------------|
| identifier | ESDTTransfer |
| address | the sender of the token |
| topics | `topics[0]` - token identifier base64 encoded <br/>`topics[1]` - empty <br/> `topics[2]` - value bytes base64 encoded <br/> `topics[3]` - receiver address address bytes base64 encoded |
| data | empty |

</TabItem>
<TabItem value="Example">

```json
{
"identifier": "ESDTTransfer",
"address": "erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u",
"topics": [
"VVRLLWI5NzQ4MA==",
"",
"AzsuPJ/QgDzoAAAA",
"0+diI4/UjUcgbmchGtML1QwheMY68dnsww9vhRPJUWg="
],
"data": null
}
```

</TabItem>
</Tabs>


### Semi-fungible, non-fungible or meta-esdt token creation

The `ESDTNFTCreate` event is generated when a new token is created using the built-in function `ESDTNFTCreate`.

<Tabs
defaultValue="Structure"
values={[
{label: 'Structure', value: 'Structure'},
{label: 'Example', value: 'Example'},
]}
>
<TabItem value="Structure">

| Field | Value |
|------------|------------------------------------------------------------------------------------------------------------------------------|
| identifier | ESDTNFTCreate |
| address | the creator of the token |
| topics | `topics[0]` - token identifier base64 encoded <br/>`topics[1]` - token nonce bytes base64 encoded <br/> `topics[2]` - value bytes base64 encoded <br/> `topics[3]` - ESDigitalToken structure marshalled with gogo proto serializer |
| data | empty |

</TabItem>
<TabItem value="Example">

```json
{
"identifier": "ESDTNFTCreate",
"address": "erd1qqqqqqqqqqqqqpgq0tajepcazernwt74820t8ef7t28vjfgukp2sw239f3",
"topics": [
"TFlaLTBmM2MxMQ==",
"AQ==",
"AQ==",
"CAESAgABIvwBCAESBWx5cmFaGiAJ7NX5x1oDr20FnI7bUkyNRhecngUl6Jlvjjzlcu0BuSD0Ayo7YmFma3JlaWNqbXVwMndna21qaXR0a2dpbzZydXlpb3h6cHpraHZ6b3Jvand5eHU0Y2RiNnQycHRhaGkyQmlwZnM6Ly9iYWZrcmVpY2ptdXAyd2drbWppdHRrZ2lvNnJ1eWlveHpwemtodnpvcm9qd3l4dTRjZGI2dDJwdGFoaTpLbWV0YWRhdGE6YmFma3JlaWNqbXVwMndna21qaXR0a2dpbzZydXlpb3h6cHpraHZ6b3Jvand5eHU0Y2RiNnQycHRhaGkvbHlyYVp9"
],
"data": null
}
```

</TabItem>
</Tabs>

### Semi-fungible, non-fungible or meta-esdt token transfer

The `ESDTNFTTransfer` event is generated when a token, which can be semi-fungible, non-fungible, or meta-esdt,
is moved through the `ESDTNFTTransfer` built-in function.

<Tabs
defaultValue="Structure"
values={[
{label: 'Structure', value: 'Structure'},
{label: 'Example', value: 'Example'},
]}
>
<TabItem value="Structure">

| Field | Value |
|------------|------------------------------------------------------------------------------------------------------------------------------|
| identifier | ESDTNFTTransfer |
| address | the sender of the token |
| topics | `topics[0]` - token identifier base64 encoded <br/>`topics[1]` - token nonce bytes base64 encoded <br/> `topics[2]` - value bytes base64 encoded <br/> `topics[3]` - receiver address bytes base64 encoded |
| data | empty |

</TabItem>
<TabItem value="Example">

```json
{
"identifier": "ESDTNFTTransfer",
"address": "erd1qqqqqqqqqqqqqpgq0tajepcazernwt74820t8ef7t28vjfgukp2sw239f3",
"topics": [
"WE1FWC1mZGEzNTU=",
"Aw==",
"LUrGxb4/2VjTAA==",
"0+diI4/UjUcgbmchGtML1QwheMY68dnsww9vhRPJUWg="
],
"data": null
}
```

</TabItem>
</Tabs>


### Multi token transfer

The `MultiESDTNFTTransfer` event is generated when one or multiple tokens are transferred using the built-in
function `MultiESDTNFTTransfer`.


<Tabs
defaultValue="Structure"
values={[
{label: 'Structure', value: 'Structure'},
{label: 'Example', value: 'Example'},
]}
>
<TabItem value="Structure">

| Field | Value |
|------------|---------------------------------------------------------------------------------------------------------------------------------|
| identifier | MultiESDTNFTTransfer |
| address | the sender of the token |
| topics | `topics[0]` - token identifier <br/>`topics[1]` - token nonce base64 encoded (can be empty in case of fungible token) <br/> `topics[2]` - value bytes base64 encoded <br/> `topics[3]` - receiver address bytes base64 encoded |
| data | empty |

</TabItem>
<TabItem value="Example">

```json
{
"identifier": "MultiESDTNFTTransfer",
"address": "erd1qqqqqqqqqqqqqpgq0tajepcazernwt74820t8ef7t28vjfgukp2sw239f3",
"topics": [
"WE1FWC1mZGEzNTU=",
"Aw==",
"LUrGxb4/2VjTAA==",
"0+diI4/UjUcgbmchGtML1QwheMY68dnsww9vhRPJUWg="
],
"data": null
}
```

</TabItem>
</Tabs>

:::note
For a multi-token transfer operation, multiple `MultiESDTNFTTransfer` events will be generated, one for each token being transferred.
:::

:::important Important
Starting from release `rc/v1.6.0`, the `MultiESDTNFTTransfer` will be changed when the flag `ScToScLogEventEnableEpoch` will be enabled.

Instead of generating multiple events with the same identifier, only one event will be generated for the entire multi-token transfer operation.
The event will follow the new format outlined below:

<Tabs
defaultValue="Structure"
values={[
{label: 'Structure', value: 'Structure'},
{label: 'Example', value: 'Example'},
]}
>
<TabItem value="Structure">

| Field | Value |
|------------|---------------------------------------------------------------------------------------|
| identifier | MultiESDTNFTTransfer |
| address | the sender of the token |
| topics | `PAIRS OF` <br/> < <br/>`topics[i]` - token identifier <br/>`topics[i+1]` - token nonce base64 encoded (can be empty in case of fungible token)<br/> `topics[i+2]` - value bytes base64 <br/>> <br/> `topics[n-1]` - receiver address |
| data | empty |

</TabItem>
<TabItem value="Example">

```json
{
"identifier": "MultiESDTNFTTransfer",
"address": "erd1j467tvyyr2dtxdz3lsgqaeez5umjsdn8fajexqlu7eum5wx2u0aqkca23a",
"topics": [
"MzlINk8tNDc5NmI4",
"Aw==",
"AQ==",
"UFFTMFItZDlmOTlk",
"",
"AQ==",
"StPRLp5kwnctf4If2CUhKr6Vux8WN3k3i5chL/y93UQ="
],
"data": null
}
```

</TabItem>
</Tabs>


:::



Loading
Loading