Giter Club home page Giter Club logo

ricochet-analytics's Introduction

Ricochet Analytics

1. Dune Analytics

Contains the queries behind the Ricochet Dune Analytics Dashboard at https://dune.xyz/mikeghen1/Ricochet-Exchange

2. Profitability Analysis

Python scripts which assess the profitability of Ricochet's stream markets. This involves comparing the cost of running keepers (gas) against the fees earned by these markets.

3. $RIC Supply and Price Endpoint

A deployed HTTPS endpoint with RIC token supply and price data. This endpoint would be utilized by token data viewing services such as CoinGecko to display.

4. DAO Treasury Net Worth

  • Python scripts that calculates the true total net worth of Ricochet's DAO treasury.

    • TotalNetWorth = Sum(TokenBalances) + Sum(AmountOnLoanFromBank)
  • Brownie framework for structure of scripts and contracts/interfaces utilized

  • Alchemy websocket utilized within the brownie networks setup under id polygon-main-ws

5. Ricochet subgraph

Contains the Ricochet Exchange subgraph source code

ricochet-analytics's People

Contributors

mikeghen avatar mrsquiggles13 avatar samirsalem avatar spitko avatar sunnyjaycer avatar theschein avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

ricochet-analytics's Issues

Active streamers/Unique addresses

We need an overview of the number of active streamers/unique addresses interacting with the rexMarket contracts. Currently, we lack this information as we only track the number of active streams which is a valuable data point but insufficient to get a holistic overview.

Top RexBank Borrowers

This issue is to make a query in Dune that shows who the top borrowers are so we can identify them and monitor what they're doing with the funds they borrow from RexBank. The calculation should be done using amount borrow - amount repaid

Exchange Keeper Break-even Flow Rate Analysis

We really need an easy way to keep track of when the markets are profitable. Theres a break even volume through a market that needs to occur to make it profitable based on fee collected. This issue is about making a tool to quickly get that information

Coingecko vs. Launchpad Price

I keep noticing that the launchpad price is often higher than Coingecko. Its a pretty good metric so I'm opening this issue for someone to make a chart that overlays the two time series on top of each other.
IMG_4788

Current Event Trackers Too Slow

It seems to get metrics that involve either past transactions or events is too slow a process as one has to loop through every block since the contract was created in order to capture certain transactions and or events.

I have found a service that can do this instantly and I happen to have a domain on hostinger that is being unused which I could get create a demo or even a permanent source for event/transaction history service.

I am also open to suggestions hence the issue since I want to go about this in the best way possible.

From my observations it is best to utilize a service like the one I'm using (Moralis) and call upon the DB rendered to set up whatever kind of statistics we need.

DAO Treasury Net Worth

This issue involves using web3py or similar to get the actual treasury balance. The treasury balance is the sum of:

  1. The erc20/supertokens

  2. The USDC on loan at the bank

  3. For getting the erc20 and supertoken balances, use polygonscan and query balances for the tokens listed in the RIC network directory: https://docs.ricochet.exchange/docs/network-directory#super-tokens (Skip LP tokens they're de minimus)

  4. The amount on loan at the bank requires you to query the blockchain for VaultBorrow and VaultRepay the amount in the bank is:

sum(vaultBorrows) - sum(vaultRepayments) + balanceOf USDC in the contract

There's three bank contracts listed in the network directory: https://docs.ricochet.exchange/docs/network-directory#rex-banks

You can use Polygonscan and export the ERC20 transactions for the bank contract and do this math in google sheets to verify it. See this document for querying for event history on chain: https://web3py.readthedocs.io/en/stable/filters.html#event-log-filters

Supply and Price Endpoint

Create and deploy an HTTPS endpoint with RIC token supply and price data. something CoinGecko can use

Initial Profitability Analysis

Python scripts which assess the profitability of Ricochet's stream markets. This involves comparing the cost of running keepers (gas) against the fees earned by these markets.

https://github.com/Ricochet-Exchange/ricochet-analytics/tree/master/02-profitability-analysis

You will want to take a historic-till-now look and a current look.

Historic:

  • For a selected rexMarket, parse through all previous transactions (so like all ~5.5k transactions for this DAI>WETH market: https://polygonscan.com/address/0x27C7D067A0C143990EC6ed2772E7136Cfcfaecd6)
  • For each distribution transaction (every transaction is a distribution), parse out:
    1. Fee taken - gather amount in native token and then amount in USD based on the price of the native token at the time of the transaction execution
    2. Gas fee - how much gas was spent on that transaction in MATIC and then amount in USD based on the price of MATIC at the time of the transaction execution
    This data could be stored in a CSV
  • You would then report--based on total profit (fees taken) and total expenses (gas fee)--the overall profit/loss of the rexMarket.

Current:

  • Revenue = Current TVS * fee (fee is currently 2%)
  • Costs = Total gas fees of previous 30 days
  • P&L = Revenue - Costs
    A forecasted P&L that integrates gas cost projections would merit additional reward here.

All rexMarket addresses can be found at https://docs.ricochet.exchange/docs/network-directory

Keeper Activity Dashbaord

We need a way to view the quality of the keepers. Keepers should be submitting distribute transactions to the REXMarket contracts. The questions we need to be able to answer about the keepers are:

  1. How much gas is each keeper spending?
  2. What is the average time between keeper distribute transactions for each contract?
  3. How many contracts is each keeper keeping on? (i.e. how many contracts do they submit distribute transactions to)
  4. Whats the average time between distribute transactions for each contract?
  5. How much RIC has each keeper earned from the DAO? (We switched for streaming RIC to ERC20 transferring RIC once a month)

The quality assurance on keeprs is mainly about liveliness so the average time between submitting transactions to the REXMArket contracts is the primary metric. The metric we want is the average cycle time for each keeper on each contract, with the idea being they should all be around the same time (~1 hour). Sometimes transactions fail so I wouldn't expect any of the keepers to be at 1 hour cycle times but it should be something we aspire too.

Bank Borrow/Lend Dashboard

Create a dashboard that shows how much has been borrowed and repaid by the REX Bank. There's a VaultBorrow, VaultRepay events that should be used. I perfer to do this in Dune, but using web3py/js would be acceptable too. in the case of using web3, make a script that can be run on the command line and will output results to the console.

Figure out how much was borrowed from the bank

This issue involves pulling data from on-chain to figure out how much is on loan from the bank. There's a vaultBorrow event I think you can query on-chain, also a vaultRepay event. The sum of these events should give the current amount being borrowed from the bank.

I think a Dune Analytics dashboard would be a good solution. But python/js scripts would be OK as well.

Automate deploy of subgraph

If any change is performed on the subgraph code it should be automatically redeployed, ideally using github actions

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.