Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We can now track total, daily, and hourly rebates earned by makers. Initially this update was so we can display it on defi llama, but we can plug this in wherever we're using
Metrics
subgraphs.Currently (July 12) the
RubiconMetricsOptimism
subgraph is 7 days into syncing with a few days left.RubiconMetricsArbitrum
is fully synced. Neither of these are updated with these fee changes so we can't display fees on defi llama. If we wanted to re-sync with these changes, we would have (possibly) 12ish days of downtime onRubiconMetricsOptimism
and only a few hours of downtime onRubiconMetricsArbitrum
. Too much downtime for us to handle right now with all the new users from OP rewards and arb launch. Maybe wait until we have our own archival node (I assume syncing on our own archival is faster than hosted service).Schema changes
New entities:
HourMakerRebateVolume
andDayMakerRebateVolume
follow same pattern asHourVolume
andDayVolume
.New field on
Rubicon
entity:total_maker_rebate_volume_usd
tracks the total amount of fees paid to makers in USD.Handler changes
All new fields and entities are updated in new event handler
handleFee
that handles theemitFee
event.First, the
handleFee
checks if theemitFee
event is paid to a maker:Then it follows the same pattern as
handleLogTake
to convertevent.params.feeAmt
into USD value ofevent.params.asset
(asset that was paid to maker) and updateRubicon
,HourMakerRebateVolume
, andDayMakerRebateVolume
.Other changes
Added
Metrics/src/utils/entities/fee.ts
which contains functionisFeeMakerRebate(event: emitFee)
. This function makes a call to a deployed RubiconMarket to check if the address the fee was sent to is the protocol'sfeeTo
address.Added
RubiconMarket
addresses toMetrics/src/prices/config/arbitrumOne.ts
andoptimism.ts
Notes
rebates
orrevenue
orfee
. I settled onrebates
because that is what they are referred to in our docs https://docs.rubicon.finance/protocol/rubicon-market/fees but I can make a switch.isFeeMakerRebate(emitFee)
was. Let me know where I should move it to and if I should separate out the portions where it connects to the contract and makes the call into separate components for better organization.TODOs
Could easily update the schema to also track protocol revenue from fees if we want. Would need to update
handleFee
to not immediately return if fee is paid to the protocol and add logic inside that check.