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

Generate analytics vaa metric #280

Closed
gipsh opened this issue May 3, 2023 · 0 comments
Closed

Generate analytics vaa metric #280

gipsh opened this issue May 3, 2023 · 0 comments
Assignees
Milestone

Comments

@gipsh
Copy link
Contributor

gipsh commented May 3, 2023

Based on the VAA we need to generate a metric on influxdb and populate the data.
The analytics componen will be in charge of this new metric called vaa.

The vaa metric contains the serialized information from the VAA and also metadata like token symbol and notional value
in the moment the vaa was created.

The vaa metric should include those tags:

  • origin_chain --> solana/eth/etc
  • detination_chain --> idem
  • token --> symbol like ETH/wETH/1SOL/etc
  • origin_address --> address of the ECR-20 on the origin_chain
  • destination_address --> destination wallet

The vaa metric should include those fields:

  • amount --> amount of the asset transfered
  • notional --> price of the asset when the vaa was created
  • v = amount * notional

This is an example of a generated metric on line protocol fomat:

vaa,origin_chain=solana,target_chain=bsc,token=ETH,origin_address=solana,target_address=000000000000000000000000808522060e36128fc3ae58ca2f2789b5a4444444 amount=2.600000,notional=1.2341 1634633931000000000

For this metric to be generated we need:

The workflow should be like this:

  1. Analytics receives a VAA
  2. Decode it and increment the VAA count metric
  3. Decodes de payload. If is not a portal payload returns.
  4. Try to find the symbol using the resolver.
  5. If its avalid symbol then tries to fetch the notional
  6. Push the data to influx
@gipsh gipsh changed the title Generate analytics main metric Generate analytics vaa metric May 3, 2023
@gipsh gipsh added this to the v1 milestone May 3, 2023
@gipsh gipsh mentioned this issue May 3, 2023
3 tasks
@agodnic agodnic self-assigned this May 3, 2023
agodnic added a commit that referenced this issue May 4, 2023
### Summary

This pull request adds volume metrics to influxdb. Also, it adds the 24h volume metric to `GET /api/v1/scorecards`.

Tracking issues: #221, #280

### Changes:
* The `parser` service no longer generates metrics for influxdb. All metrics-related code was removed from that service, that code was moved to the analytics service instead.
* New volume metrics were added to the analytics service.
* The notional cache was modified to use token names (i.e.: ticker symbols) as keys instead of chain IDs.
* The notional cache reader was moved to the `common/client/cache` package.
* A little bit of duplicated code between the cache reader and writer was removed.
* A 24h volume metric was added to `GET /api/v1/scorecards`.
* A dictionary that stores token metadata was added under `common/domain/tokenbridge.go`. More tokens will be added to it in the near future.
@agodnic agodnic closed this as completed May 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants