Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fees - BetSwirl] Add Base and update subgraphs IDs #2122

Merged
merged 1 commit into from
Nov 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 26 additions & 59 deletions fees/betswirl/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import { BSC, POLYGON, AVAX, ARBITRUM } from "../../helpers/chains";
import { Chain } from "@defillama/sdk/build/general";

const endpoints: any = {
[BSC]: sdk.graph.modifyEndpoint('DhivnGkd3FnqgEDpBi8xP2QeqdBB1LWjakwdL7W6KJoE'),
[BSC]: sdk.graph.modifyEndpoint('69xMkatN58qWXZS7FXqiVQmvkHhNrq3thTfdB6t85Wvk'),
[POLYGON]:
sdk.graph.modifyEndpoint('FL3ePDCBbShPvfRJTaSCNnehiqxsPHzpLud6CpbHoeKW'),
[AVAX]: sdk.graph.modifyEndpoint('WicBtHWBzT58U45mCh9QEBRib1ieqt86yiNkXvPdkEN'),
[ARBITRUM]: sdk.graph.modifyEndpoint('8awdcK7DwcmmamNBHxobxpxMyRFkoQpF678rHsqB1yJq'),
[AVAX]: sdk.graph.modifyEndpoint('4nQJ4T5TXvTxgECqQ6ox6Nwf57d5BNt6SCn7CzzxjDZN'),
[ARBITRUM]: sdk.graph.modifyEndpoint('AsPBS4ymrjoR61r1x2avNJJtMPvzZ3quMHxvQTgDJbU'),
base: sdk.graph.modifyEndpoint('6rt22DL9aaAjJHDUZ25sSsPuvuKxp1Tnf8LBXhL8WdZi'),
};

interface IToken {
Expand All @@ -19,13 +20,15 @@ interface IToken {
partnerAmount: string;
treasuryAmount: string;
teamAmount: string;
affiliateAmount: string;
}
interface IPvPToken {
id: string;
dividendAmount: string;
initiatorAmount: string;
treasuryAmount: string;
teamAmount: string;
affiliateAmount: string;
}

interface IGraph {
Expand All @@ -51,6 +54,7 @@ function graphs() {
partnerAmount
treasuryAmount
teamAmount
affiliateAmount
}
yesterdayTokens: tokens(block: { number: ${yesterdaysBlock} }) {
id
Expand All @@ -59,6 +63,7 @@ function graphs() {
partnerAmount
treasuryAmount
teamAmount
affiliateAmount
}
}`
);
Expand All @@ -71,13 +76,15 @@ function graphs() {
initiatorAmount
treasuryAmount
teamAmount
affiliateAmount
}
yesterdayPvPTokens: pvPTokens(block: { number: ${yesterdaysBlock} }) {
id
dividendAmount
initiatorAmount
treasuryAmount
teamAmount
affiliateAmount
}
}`
);
Expand All @@ -96,10 +103,10 @@ function graphs() {
const totalSupplySideRevenue = createBalances()
for (const token of graphRes.todayTokens) {
let tokenKey = token.id.split(':')[0];
const { dividendAmount, bankAmount, partnerAmount, treasuryAmount, teamAmount } = token
const { dividendAmount, bankAmount, partnerAmount, treasuryAmount, teamAmount, affiliateAmount } = token

totalFees.add(tokenKey, +dividendAmount + +bankAmount + +partnerAmount + +treasuryAmount + +teamAmount)
dailyFees.add(tokenKey, +dividendAmount + +bankAmount + +partnerAmount + +treasuryAmount + +teamAmount)
totalFees.add(tokenKey, +dividendAmount + +bankAmount + +partnerAmount + +treasuryAmount + +teamAmount + +affiliateAmount)
dailyFees.add(tokenKey, +dividendAmount + +bankAmount + +partnerAmount + +treasuryAmount + +teamAmount + +affiliateAmount)
totalSupplySideRevenue.add(tokenKey, +bankAmount + +partnerAmount)
dailySupplySideRevenue.add(tokenKey, +bankAmount + +partnerAmount)
totalProtocolRevenue.add(tokenKey, +treasuryAmount + +teamAmount)
Expand All @@ -111,9 +118,9 @@ function graphs() {
}
for (const token of graphPvPRes.todayPvPTokens) {
let tokenKey = token.id.split(':')[0];
const { dividendAmount, initiatorAmount, treasuryAmount, teamAmount } = token
totalFees.add(tokenKey, +dividendAmount + +initiatorAmount + +treasuryAmount + +teamAmount)
dailyFees.add(tokenKey, +dividendAmount + +initiatorAmount + +treasuryAmount + +teamAmount)
const { dividendAmount, initiatorAmount, treasuryAmount, teamAmount, affiliateAmount } = token
totalFees.add(tokenKey, +dividendAmount + +initiatorAmount + +treasuryAmount + +teamAmount + +affiliateAmount)
dailyFees.add(tokenKey, +dividendAmount + +initiatorAmount + +treasuryAmount + +teamAmount + +affiliateAmount)
totalSupplySideRevenue.add(tokenKey, +initiatorAmount)
dailySupplySideRevenue.add(tokenKey, +initiatorAmount)
totalProtocolRevenue.add(tokenKey, +treasuryAmount + +teamAmount)
Expand All @@ -126,17 +133,17 @@ function graphs() {

for (const token of graphRes.yesterdayTokens) {
let tokenKey = token.id.split(':')[0];
const { dividendAmount, bankAmount, partnerAmount, treasuryAmount, teamAmount } = token
dailyFees.add(tokenKey, 0 - +dividendAmount - +bankAmount - +partnerAmount - +treasuryAmount - +teamAmount)
const { dividendAmount, bankAmount, partnerAmount, treasuryAmount, teamAmount, affiliateAmount } = token
dailyFees.add(tokenKey, 0 - +dividendAmount - +bankAmount - +partnerAmount - +treasuryAmount - +teamAmount - +affiliateAmount)
dailyHoldersRevenue.add(tokenKey, 0 - +dividendAmount)
dailyProtocolRevenue.add(tokenKey, 0 - +treasuryAmount - +teamAmount)
dailyRevenue.add(tokenKey, 0 - +treasuryAmount - +teamAmount - +dividendAmount)
dailySupplySideRevenue.add(tokenKey, 0 - +bankAmount - +partnerAmount)
}
for (const token of graphPvPRes.yesterdayPvPTokens) {
let tokenKey = token.id.split(':')[0];
const { dividendAmount, initiatorAmount, treasuryAmount, teamAmount } = token
dailyFees.add(tokenKey, 0 - +dividendAmount - +initiatorAmount - +treasuryAmount - +teamAmount)
const { dividendAmount, initiatorAmount, treasuryAmount, teamAmount, affiliateAmount } = token
dailyFees.add(tokenKey, 0 - +dividendAmount - +initiatorAmount - +treasuryAmount - +teamAmount - +affiliateAmount)
dailyHoldersRevenue.add(tokenKey, 0 - +dividendAmount)
dailyProtocolRevenue.add(tokenKey, 0 - +treasuryAmount - +teamAmount)
dailyRevenue.add(tokenKey, 0 - +treasuryAmount - +teamAmount - +dividendAmount)
Expand All @@ -162,57 +169,12 @@ function graphs() {
const meta = {
methodology: {
UserFees: "The player is charged of the fee when a bet is won. Or the PvP game prize pool.",
Fees: "All fees (called «house edge» from 2.4% to 3.5% of the payout) comes from the player's bet. The fee has several allocations: Bank, Partner, Dividends, Treasury, and Team. The house edge on PvP games is from 3.5% to 7% allocated to Dividends, Host, Treasury and Team.",
Fees: "All fees (called «house edge» from 2.4% to 4% of the payout) comes from the player's bet. The fee has several allocations: Bank, Partner, Affiliate, Dividends, Treasury, and Team. The house edge on PvP games is from 3.5% to 7% allocated to Dividends, Host, Affiliate, Treasury and Team.",
Revenue: "Dividends, Treasury and Team fee allocations.",
ProtocolRevenue: "Treasury and Team fee allocations.",
HoldersRevenue: "Dividends fee allocations.",
SupplySideRevenue: "Bank and Partner fee allocations, or Host allocation on PvP games.",
},
// hallmarks: [
// // Polygon
// [1645970923, "BetSwirl deposit: 2.6k MATIC"],
// [1645976015, "BetSwirl deposit: 1.1k MATIC"],
// [1646136632, "BetSwirl deposit: 1.3k MATIC"],
// [1647366653, "BetSwirl deposit: 544m BETS"],
// [1647445756, "BetSwirl deposit: 7.2k MATIC"],
// [1655245802, "Sphere deposit: 1.3m SPHERE"],
// // [31115990, "BetSwirl deposit: 9k MATIC"], // Transfer to v2
// // [32898892, "BetSwirl deposit: 16.6k MATIC"], // Transfer to v3
// // [32898952, "BetSwirl deposit: 554m BETS"], // Transfer to v3
// // [35726240, "BetSwirl deposit: 556m BETS"], // Transfer to v4
// // [35726240, "BetSwirl deposit: 20.3k MATIC"], // Transfer to v4
// [1669205490, "BetSwirl deposit: 5 wETH"],
// [1669330628, "Jarvis deposit: 106k jMXN"],
// [1669330780, "Jarvis deposit: 5.3k jEUR"],
// [1675356553, "Jarvis deposit: 15.7k jEUR"],
// [1675420032, "BetSwirl deposit: 21k MATIC"],
// [1675815093, "BetSwirl deposit: 777M PolyDoge"],

// // BNB
// [1649191463, "BetSwirl deposit: 10 BNB"],
// [1649616314, "BetSwirl deposit: 75m BETS"],
// [1652807622, "BetSwirl deposit: 29 BNB"],
// [1652808633, "BetSwirl deposit: 75m BETS"],
// [1654293017, "Titano deposit: 40m TITANO"],
// [1655707329, "BetSwirl deposit: 51m BETS"], // to check
// [1659023680, "BetSwirl deposit: 15 BNB"],
// // [21190276, "BetSwirl deposit: 49 BNB"], // Transfer to v3
// // [21190300, "BetSwirl deposit: 197m BETS"], // Transfer to v3
// // [21526500, "Titano deposit: 240m TITANO"], // Transfer to v3
// // [23129957, "BetSwirl deposit: 57 BNB"], // Transfer to v4
// // [23129957, "BetSwirl deposit: 199m BETS"], // Transfer to v4
// [1670448025, "MDB deposit: 3m MDB"],
// [1670448049, "MDB deposit: 15.5k MDB+"],

// // Avalanche
// [1655506365, "BetSwirl deposit: 350 AVAX"],
// [1655506474, "BetSwirl deposit: 23m BETS"],
// [1655519330, "BetSwirl deposit: 127m BETS"],
// [1655707066, "BetSwirl deposit: 50m BETS"],
// // [19714942, "BetSwirl deposit: 395 AVAX"], // Transfer to v3
// [1662768298, "ThorFi deposit: 27k THOR"],
// // [19714974, "BetSwirl deposit: 200m BETS"], // Transfer to v3
// ],
};

const adapter: Adapter = {
Expand All @@ -238,6 +200,11 @@ const adapter: Adapter = {
fetch: graphs()(ARBITRUM),
meta,
},
base: {
start: '2024-11-04',
fetch: graphs()('base'),
meta,
},
},
}

Expand Down
Loading