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

Event log documentation #702

Merged
merged 5 commits into from
Oct 10, 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: 0 additions & 5 deletions docs/developers/event-logs/contract-deploy-events.md

This file was deleted.

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

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


Contract deploy events are generated when a transaction involves either the deployment of a
smart contract or an upgrade to an existing contract.

### Contract deploy event

The contract deploy event is generated upon the successful execution of a transaction that includes
the deployment of a smart contract, without encountering any errors.


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

| Field | Value |
|------------|------------------------------------------------------------------------------------------------------------------------|
| identifier | SCDeploy |
| address | the address of the deployed contract |
| topics | `topics[0]` - the address bytes of the deployed contract base64 encoded <br/>`topics[1]` - the address bytes of the deployer of the smart contract base64 encoded <br/> `topics[2]` - the code hash bytes of the deployer smart contract base64 encoded |
| data | empty |

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

```json
{
{
"address": "erd1qqqqqqqqqqqqqpgqnnl9nn0kuuckhg24g02hq2745n4jk2hp327qcay4nm",
"identifier": "SCDeploy",
"topics": [
"AAAAAAAAAAAFAJz+Wc325zFroVVD1XAr1aTrKyrhirw=",
"NRl7AwoM3hEPC0t9RTDy7gdJUSJvKC5dpJwLYaHLirw=",
"bJtNdzjeaYecInf/NpHzSjHJEZ2l6hR/uJh0NkLIe+k="
],
"data": null
}
}
```

</TabItem>
</Tabs>


### Contract upgrade event

The contract upgrade event is generated when a transaction, involving an upgrade, is successfully executed without any errors.


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

| Field | Value |
|------------|------------------------------------------------------------------------------------------------------------------------|
| identifier | SCUpgrade |
| address | the address of the deployed contract |
| topics | `topics[0]` - the address bytes of the upgraded contract base64 encoded <br/>`topics[1]` - the address bytes of the upgrader of the smart contract base64 encoded <br/> `topics[2]` - the code hash bytes of the upgraded smart contract base64 encoded |
| data | empty |

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

```json
{
"address": "erd1qqqqqqqqqqqqqpgqnnl9nn0kuuckhg24g02hq2745n4jk2hp327qcay4nm",
"identifier": "SCUpgrade",
"topics": [
"AAAAAAAAAAAFAJz+Wc325zFroVVD1XAr1aTrKyrhirw=",
"NRl7AwoM3hEPC0t9RTDy7gdJUSJvKC5dpJwLYaHLirw=",
"kUVJtdwvHG2sCTi9l2uneSONUVonWfgHCK69gdB+52o="
],
}
```

</TabItem>
</Tabs>


### Change owner event

The `ChangeOwnerAddress` event is generated upon the successful execution of a transaction that specifically involves
a `ChangeOwnerAddress` built-in function call, and this execution must occur without encountering any errors.


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

| Field | Value |
|------------|------------------------------------------------------------------------------------------------------------------------|
| identifier | ChangeOwnerAddress |
| address | the address of the contract |
| topics | `topics[0]` - the address bytes of the new contract owner base64 encoded |
| data | empty |

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

```json
{
"address": "erd1qqqqqqqqqqqqqpgqnnl9nn0kuuckhg24g02hq2745n4jk2hp327qcay4nm",
"identifier": "ChangeOwnerAddress",
"topics": [
"UKAg0hORMjk0oT6RalZp1w0Xulvvj0Wa/SSYstBepao="
],
"data": null
}
```

</TabItem>
</Tabs>
83 changes: 83 additions & 0 deletions docs/developers/event-logs/execution-events.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,86 @@ been executed but encountered an error in the process.

</TabItem>
</Tabs>

### Transfer value only event

The `transferValueOnly` event is generated when a transaction involving multiple smart contract calls has been executed,
and during the execution, some EGLD tokens were transferred from one smart contract to another.


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

| Field | Value |
|------------|------------------------------------------------------------------------------------------------------------------------|
| identifier | transferValueOnly |
| address | the destination address |
| topics | `topics[0]` - sender address bytes base64 encoded <br/> `topics[1]` - destination address bytes base64 encoded <br/> `topics[2]` - transferred value bytes base64 encoded |
| data | empty |

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

```json
{
"identifier": "transferValueOnly",
"address": "erd1qqqqqqqqqqqqqpgqd77fnev2sthnczp2lnfx0y5jdycynjfhzzgq6p3rax",
"topics": [
"AAAAAAAAAAAFADz3VNyYTcz4h9Y/rLRPPr0jIp5kL5w=",
"AAAAAAAAAAAFAG+8meWKgu88CCr80meSkmkwSck3EJA=",
"9DzAfFqMRw=="
]
"data": "",
}
```

</TabItem>
</Tabs>


:::important Important
From the `rc/v1.6.0` release onward, the `transferValueOnly` will undergo a modification once the `ScToScLogEventEnableEpoch` flag is activated as follows:

bogdan-rosianu marked this conversation as resolved.
Show resolved Hide resolved

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

| Field | Value |
|------------|---------------------------------------------------------------------------------------|
| identifier | transferValueOnly |
| address | the sender address |
| topics | `topics[0]` - transferred value bytes base64 encoded <br/> `topics[1]` - destination address bytes base64 encoded |
| data | empty |

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

```json
{
"identifier": "transferValueOnly",
"address": "erd1qqqqqqqqqqqqqpgqd77fnev2sthnczp2lnfx0y5jdycynjfhzzgq6p3rax",
"topics": [
"AQ==",
"rwBuzoNHMQTqkff/VgXEwXQvchSh9GvimeMO4uhwcWk="
],
"data": null
}
```

</TabItem>
</Tabs>

:::

Loading