[fix] p2p.me - remove fees adapter (reported revenue is an unverifiable off-chain spread) - #7640
Conversation
The adapter reports a modeled off-chain buy/sell price spread as Fees/Revenue/ProtocolRevenue, but p2p.me takes no fee on chain: no fee field in the event, buyers receive the full amount, the contract is a net-negative escrow float, and no address is a volume-scaling net sink. The on-chain reconstruction and the six negative fee tests are in the PR description.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
Summary by CodeRabbit
WalkthroughThe Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 15✅ Passed checks (15 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@MontaguSandwich If they don't have revenue, from where do they pay the affiliates? https://dune.com/p2pme/latest |
I went through the dashboard queries again and you're right, sorry. There is an on-chain fee: the OrderFlowFacet emits an AdditionalOrderDetails event (topic0 0xdac1652b...) carrying fixedFeePaid and tipsPaid, which the OrderCompleted struct doesn't include. So the "no on-chain fee" framing in the PR is wrong and I'm converting this to a fix. Decoding that event from base.logs (latest record per orderId, since it re-emits during an order): fixedFeePaid is about $9.4k all-time and $837 over the last 30 days, across the ~80k orders that carry a fee, roughly a flat $0.05 per order. the Total protocol revenue query computes turnover * (avg_buy_price - avg_sell_price)/avg_sell_price, about $457k, and the Merchants daily revenue query models the merchant commission at 2% of volume, about $380k. Those are the same ~2% of volume, so that spread is the merchants' commission (supply side), not protocol revenue. So imo an accurate adapter should book dailyProtocolRevenue from the on-chain fixedFeePaid, with tips on the supply side. I can either report just the on-chain fee, or also surface the merchant spread as dailySupplySideRevenue while keeping it out of protocol revenue. Wdyt? |
Remove the p2p.me fees adapter: reported revenue is an unverifiable off-chain spread
fees/p2pme/index.tsreports $32,244/30d and $436,339 all-time as Fees, Revenue, and ProtocolRevenue (100% to the protocol). That figure is a modeled off-chain price spread, not an observed on-chain fee. On-chain, p2p.me's contracts take no fee, and the spread the adapter attributes to the protocol accrues to the order-filling merchants/market-makers. This PR removes it; if the protocol publishes an actual on-chain fee, an accurate adapter can replace this.What the adapter computes
Per chain + currency:
where
price = fiatAmount / amountfrom the OrderCompleted events. Reconstructing this exact formula on the raw Base events reproduces the reported number (~$33k/30d). On the current packed-event contract alone it is $139,701 all-time; the $436k additionally spans the retired Polygon BrokerFactory and Base OrderProcessor sources.Six on-chain tests for a real fee, all negative
amount(USDC) andfiatAmount(off-chain) carry value; no fee/feeBps/commission field.amount)amountsum = $871,713 vs USDC actually paid out in those txs = $874,679. Buyers receive the full amount; 0 underpaid.0x42af7b2453cdbfdf51a1ce4238b514f5128cfbfereceived $83,091 and returned $83,346 (net ~ $0) = market-maker churn. Other net recipients are merchants receiving escrow settlement inside buy-order txs, not fees.0xb36c5a84ee9aa2ff341f0729f2797976f585d3fbStructural point: the diamond is net USDC-negative (-$103,311/30d, -$35,061/90d). It drains a pre-funded escrow float. A fee-taking contract retains USDC (in > out); this one pays out more than it takes in, so it cannot be skimming a fee.
The magnitude is also unstable
The reconstructed daily take-rate (
revenue / matched) swings 1.87% to 5.57% over 14 days (mean ~3.9%, ~3x range), the signature of two independently-drifting off-chain FX price series rather than a fixed protocol fee.Reproducibility
api.llama.fi/summary/fees/p2p.me0x4cad6eC90e65baBec9335cAd728DDc610c316368, OrderCompleted topic00x507539023a7b6a713438d0f44eab4f97bcf8905b183b1108148409a8e8c1ed8c; retired OrderProcessor0xb36c5a84ee9aa2ff341f0729f2797976f585d3fb; USDC0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913; market-maker wallet0x42af7b2453cdbfdf51a1ce4238b514f5128cfbfeamount = bytearray_to_uint256(bytearray_substring(data,65,32))/1e6,fiatAmount = ...(data,97,32)/1e6,orderType = ...(data,449,32)(0=buy, 1=sell, 2=pay). All figures reproduce frombase.logsplus the USDC Transfer topic0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef.