# Change to Event Emitted in Escrow.sol

**URL:** <https://forum.celo.org/t/change-to-event-emitted-in-escrow-sol/3784>\
**Category:** Developers\
**Created:** [June 9, 2022, 12:54pm UTC](https://forum.celo.org/t/change-to-event-emitted-in-escrow-sol/3784 "2022-06-09T12:54:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![arthurgousset](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.celo.org/arthurgousset/32/11117_2.png) [@arthurgousset](https://forum.celo.org/u/arthurgousset)\
**Post date:** [June 9, 2022, 12:54pm UTC](https://forum.celo.org/t/change-to-event-emitted-in-escrow-sol/3784/1 "2022-06-09T12:54:54Z")

</div>

Hi all 👋

[@eelanagaraj](https://github.com/eelanagaraj) and team are working on updates in [Escrow.sol](https://github.com/celo-org/celo-monorepo/blob/6b6ce69fde8f4868b54abd8dd267e5313c3ddedd/packages/protocol/contracts/identity/Escrow.sol), which we wanted to make you aware of ahead of time in case you are indexing or using its events (there is no immediate rush):

TLDR:

1. add support for federated attestations ([FederatedAttestations.sol](https://github.com/celo-org/celo-monorepo/blob/ASv2/packages/protocol/contracts/identity/FederatedAttestations.sol))
2. fix a [small existing bug](https://github.com/celo-org/celo-monorepo/pull/9617)
3. fix an inconsistency in the data emitted by the [`Withdrawal` event](https://github.com/celo-org/celo-monorepo/blob/6b6ce69fde8f4868b54abd8dd267e5313c3ddedd/packages/protocol/contracts/identity/Escrow.sol#L34) 👈 **Topic of this thread**

You can find more details here:

- [Change to Event Emitted in Escrow.sol · celo-org/SocialConnect · Discussion #25 · GitHub](https://github.com/celo-org/identity/discussions/25)

_I copied the [message below](https://github.com/celo-org/identity/discussions/25) for ease of reference_:

> # Change to Event Emitted in Escrow.sol
> 
> Hi all 👋
> 
> @eelanagaraj and team are working on updates in [Escrow.sol](https://github.com/celo-org/celo-monorepo/blob/6b6ce69fde8f4868b54abd8dd267e5313c3ddedd/packages/protocol/contracts/identity/Escrow.sol) to:
> 
> 1. add support for federated attestations ([FederatedAttestations.sol](https://github.com/celo-org/celo-monorepo/blob/ASv2/packages/protocol/contracts/identity/FederatedAttestations.sol))
> 2. fix a [small existing bug](https://github.com/celo-org/celo-monorepo/pull/9617)
> 3. fix an inconsistency in the data emitted by the [`Withdrawal` event](https://github.com/celo-org/celo-monorepo/blob/6b6ce69fde8f4868b54abd8dd267e5313c3ddedd/packages/protocol/contracts/identity/Escrow.sol#L34) 👈 **Topic of this thread**
> 
> ### Update in emitted `Withdrawal` event
> 
> The [`Withdrawal` event](https://github.com/celo-org/celo-monorepo/blob/6b6ce69fde8f4868b54abd8dd267e5313c3ddedd/packages/protocol/contracts/identity/Escrow.sol#L34) has the following fields:
> 
> ```solidity
> event Withdrawal(
> bytes32 indexed identifier,
> address indexed to, // <--- to field
> address indexed token,
> uint256 value,
> address paymentId
> );
> 
> ```
> 
> and is emitted when the [function `withdraw()`](https://github.com/celo-org/celo-monorepo/blob/fe7f847667a4e3b6ef59d45106d534be26b3707f/packages/protocol/contracts/identity/Escrow.sol#L160) is called:
> 
> ```solidity
> // function withdraw() [BEFORE]
> ...
> emit Withdrawal(
> payment.recipientIdentifier, 
> payment.sender, // <--- to field = payment.sender
> payment.token,
> payment.value,
> paymentId
> );
> ...
> 
> ```
> 
> Notice that the `to` field is set to the `payment.sender` instead of the `msg.sender` who will actually receive the withdrawal.  
> We would like to update the data emitted in this event to be `msg.sender.`:
> 
> ```solidity
> // function withdraw() [AFTER]
> ... 
> emit Withdrawal(
> payment.recipientIdentifier,
> msg.sender, // <--- to field = msg.sender
> payment.token,
> payment.value,
> paymentId
> );
> ...
> 
> ```
> 
> ### What does this mean?
> 
> This change would be a PATCH upgrade, according to our [Core Contracts versioning process](https://docs.celo.org/community/release-process/smart-contracts#versioning), because it is:
> 
> - backwards compatible, and
> - doesn’t change the ABI.
> 
> ⚠ But (!), this change would modify the **data captured by applications** that index the Escrow.sol events emitted on-chain. From the moment the contract is upgraded, the `to` field would reflect `msg.sender` instead of `payment.sender`.
> 
> ### 🙌 Call to action​:point\_down:
> 
> Please comment below if you are indexing Escrow.sol events and might be affected by this change.
> 
> We would like to share this update ahead of time so (d)apps that use the contract or index its events can prepare accordingly.
> 
> Thanks!

---

<div class="post-metadata">

**Author:** ![DonaFlorinda](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.celo.org/donaflorinda/32/7416_2.png) [@DonaFlorinda](https://forum.celo.org/u/DonaFlorinda)\
**Post date:** [August 9, 2022, 10:10pm UTC](https://forum.celo.org/t/change-to-event-emitted-in-escrow-sol/3784/2 "2022-08-09T22:10:26Z")

</div>

nice! thx.

naive question; could we store events in the blockchain for free or it costs gas, since it is a call?

figuring out solidity.

---

<div class="post-metadata">

**Author:** ![DonaFlorinda](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.celo.org/donaflorinda/32/7416_2.png) [@DonaFlorinda](https://forum.celo.org/u/DonaFlorinda)\
**Post date:** [August 11, 2022, 3:04pm UTC](https://forum.celo.org/t/change-to-event-emitted-in-escrow-sol/3784/3 "2022-08-11T15:04:28Z")

</div>

answering myself, and maybe others,

> Logs were designed to be a form of storage that costs significantly less gas than contract storage. Logs basically cost 8 gas per byte, whereas contract storage costs 20,000 gas per 32 bytes.

---

<div class="post-metadata">

**Author:** ![arthurgousset](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.celo.org/arthurgousset/32/11117_2.png) [@arthurgousset](https://forum.celo.org/u/arthurgousset)\
**Post date:** [August 12, 2022, 12:35pm UTC](https://forum.celo.org/t/change-to-event-emitted-in-escrow-sol/3784/4 "2022-08-12T12:35:46Z")

</div>

Thanks for following up here @DonaFlorinda!
