From 7eb0fc52f0bafafc0c078170d628288a210ea491 Mon Sep 17 00:00:00 2001 From: Dhruv Chauhan Date: Mon, 11 Sep 2023 20:48:22 +0530 Subject: [PATCH 1/5] Fix pool tvl, fees --- subgraphs/uniswap-forks/protocols/baseswap/README.md | 9 +++++---- .../deployments/baseswap-base/configurations.ts | 12 +++++++++--- subgraphs/uniswap-forks/src/mappings/pool.ts | 10 ++++++++++ 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/subgraphs/uniswap-forks/protocols/baseswap/README.md b/subgraphs/uniswap-forks/protocols/baseswap/README.md index 798a5d2570..c84cd88ef6 100644 --- a/subgraphs/uniswap-forks/protocols/baseswap/README.md +++ b/subgraphs/uniswap-forks/protocols/baseswap/README.md @@ -8,9 +8,10 @@ When users make a token swap (trade) in the Exchange tab, a trading fee is charg ## Baseswap Trading Fees & Breakdown -- 0.25% - Trade Fees +- 0.25% - Trading Fees + - 0.17% - Supply Fees + - 0.08% - Protocol Fee - 0% - LP Reward for Liquidity Providers -- 0.25% - Protocol Fee LP providers earn rewards for staking LP tokens @@ -22,7 +23,7 @@ Sum across all Pools: `Liquidity Pool TVL` ### Total Revenue USD -Sum across all Pools: `Pool Swap Trading Volume * Trading Fee` +Sum across all Pools: `Pool Swap Trading Volume * Supply Fee` ### Protocol-Side Revenue USD @@ -32,7 +33,7 @@ Sum across all Pools: `Pool Swap Trading Volume * Protocol Fee` Portion of the Total Revenue allocated to the Supply-Side (LPs). -Sum across all Pools: `Pool Swap Trading Volume * Trading Fee` +Sum across all Pools: `Pool Swap Trading Volume * Supply Fee` ### Total Unique Users diff --git a/subgraphs/uniswap-forks/protocols/baseswap/config/deployments/baseswap-base/configurations.ts b/subgraphs/uniswap-forks/protocols/baseswap/config/deployments/baseswap-base/configurations.ts index 49187961c0..13e3abdd1f 100644 --- a/subgraphs/uniswap-forks/protocols/baseswap/config/deployments/baseswap-base/configurations.ts +++ b/subgraphs/uniswap-forks/protocols/baseswap/config/deployments/baseswap-base/configurations.ts @@ -46,11 +46,11 @@ export class BaseswapBaseConfigurations implements Configurations { } // eslint-disable-next-line @typescript-eslint/no-unused-vars getTradeFee(blockNumber: BigInt): BigDecimal { - return BigDecimal.fromString("0.25"); + return BigDecimal.fromString("0.17"); } // eslint-disable-next-line @typescript-eslint/no-unused-vars getProtocolFeeToOn(blockNumber: BigInt): BigDecimal { - return BigDecimal.fromString("0.25"); + return BigDecimal.fromString("0.08"); } // eslint-disable-next-line @typescript-eslint/no-unused-vars getLPFeeToOn(blockNumber: BigInt): BigDecimal { @@ -84,12 +84,16 @@ export class BaseswapBaseConfigurations implements Configurations { "0x2ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec22", // coinbase wsETH "0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca", // usdc "0x50c5725949a6f0c72e6c4a641f24049a917db0cb", // dai + "0x65a2508c429a6078a7bc2f7df81ab575bd9d9275", // dai+ + "0xb79dd08ea68a908a97220c76d19a6aa9cbde4376", // usd+ ]; } getStableCoins(): string[] { return [ "0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca", // USDC "0x50c5725949a6f0c72e6c4a641f24049a917db0cb", // DAI + "0x65a2508c429a6078a7bc2f7df81ab575bd9d9275", // DAI+ + "0xb79dd08ea68a908a97220c76d19a6aa9cbde4376", // USD+ ]; } getStableOraclePools(): string[] { @@ -98,7 +102,9 @@ export class BaseswapBaseConfigurations implements Configurations { ]; } getUntrackedPairs(): string[] { - return []; + return [ + "0xda2e677649dd670dac5db2d0df06c97c0a92b40d", // Wrapped Ether/BaseHarryPotterObamaSonic10Inu + ]; } getUntrackedTokens(): string[] { return []; diff --git a/subgraphs/uniswap-forks/src/mappings/pool.ts b/subgraphs/uniswap-forks/src/mappings/pool.ts index 999bb818f7..85f05a94b7 100644 --- a/subgraphs/uniswap-forks/src/mappings/pool.ts +++ b/subgraphs/uniswap-forks/src/mappings/pool.ts @@ -1,3 +1,4 @@ +import { dataSource } from "@graphprotocol/graph-ts"; import { Mint, Burn, @@ -25,6 +26,7 @@ import { import { BIGINT_THOUSAND, BIGINT_ZERO, + Network, UsageType, ZERO_ADDRESS, } from "../common/constants"; @@ -44,6 +46,14 @@ export function handleTransfer(event: Transfer): void { ) { return; } + // ignore initial liquidity lock up for baseswap BSWAP-ETH pool + if ( + dataSource.network() == Network.BASE && + event.transaction.hash.toHexString() == + "0x8fe53fa234ff89bed2ca6cb2c5528f53a6e5e3df313279d694421f4cef8cc4b2" + ) { + return; + } // mints if (event.params.from.toHexString() == ZERO_ADDRESS) { handleTransferMint( From 3fffa2635f4aa3c37c0f486f71788c75404bdaeb Mon Sep 17 00:00:00 2001 From: Dhruv Chauhan Date: Mon, 11 Sep 2023 20:49:31 +0530 Subject: [PATCH 2/5] update subgraph version --- deployment/deployment.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/deployment.json b/deployment/deployment.json index 015652e344..a4418c269e 100644 --- a/deployment/deployment.json +++ b/deployment/deployment.json @@ -5300,7 +5300,7 @@ "status": "dev", "versions": { "schema": "1.3.2", - "subgraph": "1.0.0", + "subgraph": "1.1.0", "methodology": "1.0.0" }, "files": { From a6183bb2db4ec2474b84bfca770dbd83abb3d0cd Mon Sep 17 00:00:00 2001 From: Dhruv Chauhan Date: Mon, 11 Sep 2023 23:31:41 +0530 Subject: [PATCH 3/5] count WETH/BSWAP initial liquidity as transfer --- subgraphs/uniswap-forks/src/mappings/pool.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/subgraphs/uniswap-forks/src/mappings/pool.ts b/subgraphs/uniswap-forks/src/mappings/pool.ts index 85f05a94b7..4b649deae4 100644 --- a/subgraphs/uniswap-forks/src/mappings/pool.ts +++ b/subgraphs/uniswap-forks/src/mappings/pool.ts @@ -46,14 +46,6 @@ export function handleTransfer(event: Transfer): void { ) { return; } - // ignore initial liquidity lock up for baseswap BSWAP-ETH pool - if ( - dataSource.network() == Network.BASE && - event.transaction.hash.toHexString() == - "0x8fe53fa234ff89bed2ca6cb2c5528f53a6e5e3df313279d694421f4cef8cc4b2" - ) { - return; - } // mints if (event.params.from.toHexString() == ZERO_ADDRESS) { handleTransferMint( From c23a89bdb7eee1c98f3634479524e31c8e335910 Mon Sep 17 00:00:00 2001 From: Dhruv Chauhan Date: Mon, 11 Sep 2023 23:34:34 +0530 Subject: [PATCH 4/5] fix lint --- subgraphs/uniswap-forks/src/mappings/pool.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/subgraphs/uniswap-forks/src/mappings/pool.ts b/subgraphs/uniswap-forks/src/mappings/pool.ts index 4b649deae4..999bb818f7 100644 --- a/subgraphs/uniswap-forks/src/mappings/pool.ts +++ b/subgraphs/uniswap-forks/src/mappings/pool.ts @@ -1,4 +1,3 @@ -import { dataSource } from "@graphprotocol/graph-ts"; import { Mint, Burn, @@ -26,7 +25,6 @@ import { import { BIGINT_THOUSAND, BIGINT_ZERO, - Network, UsageType, ZERO_ADDRESS, } from "../common/constants"; From f40ae84c7653c14ff964e2854614f2c2504ba187 Mon Sep 17 00:00:00 2001 From: Dhruv Chauhan Date: Mon, 11 Sep 2023 23:57:15 +0530 Subject: [PATCH 5/5] update README --- subgraphs/uniswap-forks/protocols/baseswap/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subgraphs/uniswap-forks/protocols/baseswap/README.md b/subgraphs/uniswap-forks/protocols/baseswap/README.md index c84cd88ef6..7ad4f5e2c9 100644 --- a/subgraphs/uniswap-forks/protocols/baseswap/README.md +++ b/subgraphs/uniswap-forks/protocols/baseswap/README.md @@ -21,6 +21,10 @@ LP providers earn rewards for staking LP tokens Sum across all Pools: `Liquidity Pool TVL` +> Note: For WETH/BSWAP, there was an initial liquidity lock up of $410k in the WETH/BSWAP pool as BSWAP token's initial liquidity ([docs](https://base-swap-1.gitbook.io/baseswap/tokenomics/usdbswap-token), [transaction](https://basescan.org/tx/0x8fe53fa234ff89bed2ca6cb2c5528f53a6e5e3df313279d694421f4cef8cc4b2)), which is not counted in pool's liquidity on protocol's UI. +> However, we feel it should be counted as a regular transfer contributing to pool's liquidity, and will cause mispricing of LP token if not counted. +> Hence the subgraph will show WETH/BSWAP pool's liquidity greater than the protocol UI by $410k. + ### Total Revenue USD Sum across all Pools: `Pool Swap Trading Volume * Supply Fee`