As part of the Cadence 1.0 upgrade, many changes are coming to the Cadence fungible token standard. One of them is the addition of standard Withdrawn
and Deposited
events that get emitted for every fungible token implementation.
With the addition of these standard events, token implementations no longer need to emit their own events and they are in fact redundant because the standard events will get emitted either way with more metadata. Therefore all projects are encouraged to remove their existing withdraw, deposit, and burn events to reduce the event payload on any given transaction.
In accordance with these recommendations, the Flow team has a tentative plan to remove the TokensWithdrawn
, TokensDeposited
, and TokensBurned
events from the FlowToken
smart contract. This will not affect any on-chain code, but will be a breaking change for any event listeners who rely on FlowToken
events to track balances off-chain.
This change is necessary because currently the epoch transitions emit large numbers of events and with the addition of the standard events, the number of emitted events will almost double. The large event payloads for these transactions sometimes make i it impossible for the access nodes to process properly. Removing the FlowToken
events will avoid this problem and the problem of redundant events in every single transaction on Flow, since they are also emitted for regular transaction fees.
For event listeners, this change will be easy to adapt to. To start with, the Cadence 1.0 upgrade is bringing many breaking changes already, so project owners will already have to update their code to be compatible. This change to events is only a small edition to the work already required.
Projects will simply need to update their event listeners to look for the standard events instead of the existing events. For FlowToken
in particular, these events will change from FlowToken.TokensDeposited
() to FungibleToken.Deposited(type: "FlowToken.Vault", ...)
. More detailed event types are shown below:
A.0xf233dcee88fe0abe.FungibleToken.Deposited(type: String, amount: UFix64, to: Address?, toUUID: UInt64, depositedUUID: UInt64)
A.0xf233dcee88fe0abe.FungibleToken.Withdrawn(type: String, amount: UFix64, from: Address?, fromUUID: UInt64, withdrawnUUID: UInt64)
A.0xf233dcee88fe0abe.FungibleToken.Burned(type: String, amount: UFix64, fromUUID: UInt64)
where 0xf233dcee88fe0abe
is the address of the FungibleToken
contract interface on whatever network is being used. (in this case, mainnet)
These events can be found in the FungibleToken
standard here.
Therefore, event listeners will need to listen for these events that have "0x1654653399040a61.FlowToken.Vault"
as their type
argument.
The change to the FlowToken
contract as well as all the other core contracts that will be used for the upgrade can be found in this pull request. The changes are documented in the PR.
If you have any questions or feedback regarding these changes, please reply here, ask in the PR comments, or on the Flow Discord in the #protocol-builders
channel.