Angle Protocol Fees

Hi,

I am a core member of Angle protocol - a decentralized, capital efficient and over-collateralized stablecoin. The first stablecoin made is the agEUR (pegged to the EURO), the largest decentralised EURO stablecoin, with currently 50m agEUR in circulation and a total volume of 6b.

Angle generates fees from different sources:

  • Core module: Marketplace between long/short on collateral, along with single sided LPs. Fees: mint/burn from stablecoin issuance, open/close from perpetuals and interest on invested reserves.
  • Borrow module: Borrow agEUR against collateral. Earning fees via borrow,repay, interest and liquidation surcharge.

Adapter: https://cryptostats.community/discover/fees/QmaH7j4uq7KA3wZ9AfAwxRdKYMVwpjGnZKPBz5VBCzdQb1

Source : Angle built a graph via The Graph Protocol.

Link: https://www.angle.money/

Thank you for reviewing it :slight_smile:

Hello!

A quick sanity test I send query for the 29th and I get a negative number for fees paid. I have not looked deeper for the cause but wanted to let you know:

Hi, thank you, this wad off when querying for the current date, because it looked at tomorrow revenues. I fixed it in this one Angle Labs Adapter - CryptoStats

Thank you so much for your review :+1:

Hey @gs8nrv, it appears that there’s still negative numbers getting returned

Overall, I’m a bit worried about the complexity of this adapter. There’s quite a lot of logic in the adapter, some of which should probably be moved to the subgraph level. There shouldn’t really be “aggregation” being done in the adapter itself, that’s a task that’s better to be handled in the subgraph itself.

One other small optimization: Whenever doing a gt/lt comparison (such as timestamp_lt: $timestamp), it’s important to bound that search (such as timestamp_lt: ${timestamp}, timestamp_gt: ${timestamp - 100}.

Overall, I’d suggest we chat a bit more on Discord about the direction of this adapter. You’ve clearly done a lot of work building a powerful adapter! But I don’t feel very comfortable with the current state of it.

Uploaded a new one (Angle Labs Adapter - CryptoStats), I made a poor choice to use different exchange rates between 2 dates → making negative values by looking at the differences).

Yes let’s chat on Discord, but the adapter itself has nothing fancy I can walk you through it will make more sense I guess.

Thank your for your time @David