SIP 138: Update Volume Tracking Event Source

AuthorDavid Schwartz
Discussions-ToDiscord
StatusApproved
Created2021-05-17

Simple Summary

The goal of this proposal is to allow for tracking of volume sources on L2 and to improve tracking of volume sources on L1

Abstract

This SIP proposes the ExchangeTracking event add a fee param for tracking volume sources on Synthetix protocol

Motivation

At the moment we can only retrieve the volume sources on L1 and not L2. Also, the tracking of data on L1 is more complicated than it needs to be.

Specification

Overview

On L1 we use fee reclamation, which comes with a waiting period. When an exchange happens, an ExchangeTracking event is fired, followed at the end of the waiting period by an ExchangeEntryAppended event to finalize the fee reclamation process. In order to track volume sources, we need data from both of these events; however, since there is not likely to be fee reclamation on L2 we may be unable to track volume sources without the second event emitted.

This SIP proposes to modify the ExchangeTracking event to add a fee param which will remove the need for the ExchangeEntryAppended event to be used in volume source calculations on L1 or L2.

Rationale

We cannot capture volume source data right now without a fee reclamation period unless we emit extra data that is already available in the ExchangeTracking event.

Technical Specification

Old event:

ExchangeTracking(bytes32 trackingCode, bytes32 toCurrencyKey, uint256 toAmount)

New event:

ExchangeTracking(bytes32 trackingCode, bytes32 toCurrencyKey, uint256 toAmount, uint256 fee)

https://github.com/Synthetixio/synthetix/pull/1139/files -> The PR to update the ExchangeTracking event has already been written. It is ready to merge pending approval of this SIP. The only external site that might be affected by this change is the cross asset swaps by Curve; we will reach out to discuss with them before merging. Internally, we will make sure stats volume source section remains accurate when we merge this PR as well.

Test Cases

https://github.com/Synthetixio/synthetix/pull/1139/files -> Included in the PR are tests to make sure the right fee data is emitted from the event.

Configurable Values (Via SCCP)

n/a

Copyright and related rights waived via CC0.