Scout Chart Creator
  • Overview
  • Get Started
    • Tutorial 1: NMR Daily Transaction Count
    • Tutorial 2: LPT Weekly Volume (USD)
    • Tutorial 3: NMR vs LPT Daily comparison
  • Pipeline
    • Filter
    • Project
    • Group
      • Accumulators
    • Sort
    • Unwind
    • Custom
  • Data Source
    • Transactions
    • States
    • Contracts
    • Aragon
    • Livepeer
    • dYdX
    • Set
    • Token holders
  • Operators
    • Math operators
    • Logic operators
    • Function operators
    • Array operators
    • String operators
  • Config
  • Protocols
    • Dodo
      • 24H trade volume
      • Deposit & Withdraw
    • Livepeer
    • dYdX
      • Making sense of the trade data
    • MakerDao
    • Pickle Finance
      • Example: Daily deposit and withdraw of jar 0.88
      • Example: Listing all borrows of a strategy
  • FAQ
    • Dealing with "logs" field in "Transaction"
    • How to handle "Query Timeout" error?
    • How to use a variable in a Pipeline
  • Research
    • The circulating supply of DODO tokens
    • How are bitcoins doing on Ethereum? (as of Jan 20th 2021)
Powered by GitBook
On this page

Was this helpful?

  1. Protocols
  2. Pickle Finance

Example: Daily deposit and withdraw of jar 0.88

Demo: https://scout.cool/picklefinance/mainnet/dashboards/jar-0.88a

PreviousPickle FinanceNextExample: Listing all borrows of a strategy

Last updated 4 years ago

Was this helpful?

Let's build a bar chat to display the daily deposit and withdraw that happens in the Jar 0.88

1.Choose data source.

Search all the transactions which contain the log Transfer(from, to, value) and the address of the log needs to be the address of the Jar 0.88a. And to be completely safe, the contract address that the transactions interact with must be the jar 0.88a as well.

  • A Transfer(from, to, value) log is found in the transaction and the address of the log is DAI (0x6B175...).

  • The to parameter (params.1.value) of Transfer(from, to, value) is the recipient of the DAI transfer which should be the address of the jar 0.88 (0x6949B...)

  • The from parameter (params.0.value) is the sender of the DAI transfer which is user's wallet that is stored in the from field of the transaction.

Do not confuse the two "from" here. One is the from field of the transaction and the other is the name of the parameter of a log.

In the same step, we will do the same for the logs of withdraws.

What the data looks like now:

What the data looks like now:

Use sumC operator to get the cumulative value of the amount. You use sum if you don't need a cumulative chart.

Total = (depositamount - withdrawamount)

2. Use instruction.

What the data looks like now after using the instruction:

3. Use instruction to split deposit and withdraw logs into two variable.

Since each transaction can contain multiple different logs, we use operator to gather all the logs of deposits into the variable "depositlogs". In the screenshot, the first log is a log of deposit.

As explained , log of deposit is identified by

4. Use another to sum up the amount of the deposits and withdraws.

Since we do not know whether a transaction could have multiple deposit or withdraw logs, we will play safe here. We will use operator to go through every element of widthdrawlogs and depositlogs respectively and sum up the 3rd parameter value ($$this.params.2.value) of Transfer(from, to, value) which is the amount transferred. In that way, we can make sure that we do not miss any potential deposits or withdraws.

5. Finally use to organize the data by day:

6. Use to add a new field to show the total amount

Now you just need to assign _id to the X axis and depositamount, withdrawamount and total to the Y axis. Your job is done. Go have a !

🍷
Filter
Filter
Project
Project
Group
Project
👆
Transaction
filter
reduce
here
Filter instruction
We are getting close!!