diff --git a/subgraphs/saucerswap/v1/.env.mainnet b/subgraphs/saucerswap/v1/.env.mainnet new file mode 100644 index 0000000..702b627 --- /dev/null +++ b/subgraphs/saucerswap/v1/.env.mainnet @@ -0,0 +1,10 @@ +# Nodes Config +HEDERA_THE_GRAPH_NODE=https://mainnet-thegraph.swirldslabs.com/manage +IPFS_URL=https://api.thegraph.com/ipfs/ +ACCESS_TOKEN=YOUR_ACCESS_TOKEN + +#SubGraph Config +GRAPH_CONTRACT_ADDRESS=0x0000000000000000000000000000000000103780 +GRAPH_START_BLOCK=35164593 +GRAPH_NETWORK=mainnet +SUBGRAPH_NAME=saucerswap/saucerswap-v1 diff --git a/subgraphs/saucerswap/v1/.env.testnet b/subgraphs/saucerswap/v1/.env.testnet new file mode 100644 index 0000000..f772ac8 --- /dev/null +++ b/subgraphs/saucerswap/v1/.env.testnet @@ -0,0 +1,10 @@ +# Nodes Config +HEDERA_THE_GRAPH_NODE=https://testnet-thegraph.swirldslabs.com/manage +IPFS_URL=https://api.thegraph.com/ipfs/ +ACCESS_TOKEN=YOUR_ACCESS_TOKEN + +# SubGraph Config +GRAPH_CONTRACT_ADDRESS=0x00000000000000000000000000000000000026e7 +GRAPH_START_BLOCK=3354 +GRAPH_NETWORK=testnet +SUBGRAPH_NAME=saucerswap/saucerswap-v1 diff --git a/subgraphs/saucerswap/v1/src/mappings/core.ts b/subgraphs/saucerswap/v1/src/mappings/core.ts index 13ebfa6..bcf1ea8 100644 --- a/subgraphs/saucerswap/v1/src/mappings/core.ts +++ b/subgraphs/saucerswap/v1/src/mappings/core.ts @@ -23,7 +23,7 @@ import { BI_18, createLiquiditySnapshot } from './helpers' -import { FACTORY_ADDRESS } from '../types/utils/constants' +import { FACTORY_ADDRESS } from '../utils/constants' import { ERC20 } from '../types/Factory/ERC20' diff --git a/subgraphs/saucerswap/v1/src/mappings/dayUpdates.ts b/subgraphs/saucerswap/v1/src/mappings/dayUpdates.ts index 00636fb..52c8323 100644 --- a/subgraphs/saucerswap/v1/src/mappings/dayUpdates.ts +++ b/subgraphs/saucerswap/v1/src/mappings/dayUpdates.ts @@ -3,7 +3,7 @@ import { BigDecimal, BigInt, ethereum } from '@graphprotocol/graph-ts' import { Bundle, Pair, PairDayData, Token, TokenDayData, UniswapDayData, UniswapFactory } from '../types/schema' import { PairHourData } from './../types/schema' import { ONE_BI, ZERO_BD, ZERO_BI } from './helpers' -import { FACTORY_ADDRESS } from '../types/utils/constants' +import { FACTORY_ADDRESS } from './../utils/constants' export function updateUniswapDayData(event: ethereum.Event): UniswapDayData { let uniswap = UniswapFactory.load(FACTORY_ADDRESS) diff --git a/subgraphs/saucerswap/v1/src/mappings/factory.ts b/subgraphs/saucerswap/v1/src/mappings/factory.ts index aac500e..a49225e 100644 --- a/subgraphs/saucerswap/v1/src/mappings/factory.ts +++ b/subgraphs/saucerswap/v1/src/mappings/factory.ts @@ -11,7 +11,7 @@ import { ZERO_BD, ZERO_BI } from './helpers' -import { FACTORY_ADDRESS } from '../types/utils/constants' +import { FACTORY_ADDRESS } from '../utils/constants' export function handleNewPair(event: PairCreated): void { // load factory (create if first exchange) diff --git a/subgraphs/saucerswap/v1/src/mappings/helpers.ts b/subgraphs/saucerswap/v1/src/mappings/helpers.ts index db77c57..4c55ecf 100644 --- a/subgraphs/saucerswap/v1/src/mappings/helpers.ts +++ b/subgraphs/saucerswap/v1/src/mappings/helpers.ts @@ -6,7 +6,7 @@ import { ERC20NameBytes } from '../types/Factory/ERC20NameBytes' import { User, Bundle, Token, LiquidityPosition, LiquidityPositionSnapshot, Pair } from '../types/schema' import { Factory as FactoryContract } from '../types/templates/Pair/Factory' import { TokenDefinition } from './tokenDefinition' -import { FACTORY_ADDRESS } from '../types/utils/constants' +import { FACTORY_ADDRESS } from '../utils/constants' export const ADDRESS_ZERO = '0x0000000000000000000000000000000000000000' diff --git a/subgraphs/saucerswap/v1/src/mappings/pricing.ts b/subgraphs/saucerswap/v1/src/mappings/pricing.ts index cb2b9fd..a8d0cc4 100644 --- a/subgraphs/saucerswap/v1/src/mappings/pricing.ts +++ b/subgraphs/saucerswap/v1/src/mappings/pricing.ts @@ -12,7 +12,7 @@ import { TOKEN_USDT_HTS, TOKEN_LINK_HTS, TOKEN_WBTC_HTS -} from '../types/utils/constants' +} from '../utils/constants' let WETH_ADDRESS = TOKEN_WHBAR diff --git a/subgraphs/saucerswap/v1/src/mappings/tokenDefinition.ts b/subgraphs/saucerswap/v1/src/mappings/tokenDefinition.ts index 2b639a8..c81f7be 100644 --- a/subgraphs/saucerswap/v1/src/mappings/tokenDefinition.ts +++ b/subgraphs/saucerswap/v1/src/mappings/tokenDefinition.ts @@ -3,6 +3,17 @@ import { BigInt, } from "@graphprotocol/graph-ts" +import { + TOKEN_WHBAR, + TOKEN_WETH_HTS, + TOKEN_DAI_HTS, + TOKEN_USDC_HTS, + TOKEN_USDC_NATIVE, + TOKEN_USDT_HTS, + TOKEN_LINK_HTS, + TOKEN_WBTC_HTS +} from '../utils/constants' + // Initialize a Token Definition with the attributes export class TokenDefinition { address : Address @@ -23,76 +34,92 @@ export class TokenDefinition { let staticDefinitions = new Array(6) // Add WHBAR - let tokenWHBAR = new TokenDefinition( - Address.fromString('0x0000000000000000000000000000000000163b5a'), - 'WHBAR', - 'Wrapped HBAR Token', - BigInt.fromI32(8) - ) - staticDefinitions.push(tokenWHBAR) + if(TOKEN_WHBAR != '') { + let tokenWHBAR = new TokenDefinition( + Address.fromString(TOKEN_WHBAR), + 'WHBAR', + 'Wrapped HBAR Token', + BigInt.fromI32(8) + ) + staticDefinitions.push(tokenWHBAR) + } // Add DAI - let tokenDAI = new TokenDefinition( - Address.fromString('0x0000000000000000000000000000000000101af5'), - 'DAI', - 'Dai Stablecoin', - BigInt.fromI32(8) - ) - staticDefinitions.push(tokenDAI) + if(TOKEN_DAI_HTS != '') { + let tokenDAI = new TokenDefinition( + Address.fromString(TOKEN_DAI_HTS), + 'DAI', + 'Dai Stablecoin', + BigInt.fromI32(8) + ) + staticDefinitions.push(tokenDAI) + } // Add USDC Briged - let tokenUSDCBridged = new TokenDefinition( - Address.fromString('0x0000000000000000000000000000000000101ae3'), - 'USDC', - 'USDC HTS', - BigInt.fromI32(6) - ) - staticDefinitions.push(tokenUSDCBridged) + if(TOKEN_USDC_HTS != '') { + let tokenUSDCBridged = new TokenDefinition( + Address.fromString(TOKEN_USDC_HTS), + 'USDC', + 'USDC HTS', + BigInt.fromI32(6) + ) + staticDefinitions.push(tokenUSDCBridged) + } // Add USDC Native - let tokenUSDCNative = new TokenDefinition( - Address.fromString('0x0000000000000000000000000000000000101ae3'), - 'USDC', - 'USDC', - BigInt.fromI32(6) - ) - staticDefinitions.push(tokenUSDCNative) + if(TOKEN_USDC_NATIVE != '') { + let tokenUSDCNative = new TokenDefinition( + Address.fromString(TOKEN_USDC_NATIVE), + 'USDC', + 'USDC', + BigInt.fromI32(6) + ) + staticDefinitions.push(tokenUSDCNative) + } // Add USDT - let tokenUSDT = new TokenDefinition( - Address.fromString('0x0000000000000000000000000000000000101af0'), - 'USDT', - 'Tether USD', - BigInt.fromI32(6) - ) - staticDefinitions.push(tokenUSDT) + if(TOKEN_USDT_HTS != '') { + let tokenUSDT = new TokenDefinition( + Address.fromString(TOKEN_USDT_HTS), + 'USDT', + 'Tether USD', + BigInt.fromI32(6) + ) + staticDefinitions.push(tokenUSDT) + } // Add LINK - let tokenLINK = new TokenDefinition( - Address.fromString('0x0000000000000000000000000000000000101b07'), - 'LINK', - 'Chainlink Token', - BigInt.fromI32(8) - ) - staticDefinitions.push(tokenLINK) + if(TOKEN_LINK_HTS != '') { + let tokenLINK = new TokenDefinition( + Address.fromString(TOKEN_LINK_HTS), + 'LINK', + 'Chainlink Token', + BigInt.fromI32(8) + ) + staticDefinitions.push(tokenLINK) + } // Add WBTC - let tokenWBTC = new TokenDefinition( - Address.fromString('0x0000000000000000000000000000000000101afb'), - 'WBTC', - 'Wrapped Bitcoin', - BigInt.fromI32(8) - ) - staticDefinitions.push(tokenWBTC) + if(TOKEN_WBTC_HTS != '') { + let tokenWBTC = new TokenDefinition( + Address.fromString(TOKEN_WBTC_HTS), + 'WBTC', + 'Wrapped Bitcoin', + BigInt.fromI32(8) + ) + staticDefinitions.push(tokenWBTC) + } // Add WETH - let tokenWETH = new TokenDefinition( - Address.fromString('0x000000000000000000000000000000000008437c'), - 'WETH', - 'WETH HTS', - BigInt.fromI32(8) - ) - staticDefinitions.push(tokenWETH) + if(TOKEN_WETH_HTS != '') { + let tokenWETH = new TokenDefinition( + Address.fromString(TOKEN_WETH_HTS), + 'WETH', + 'WETH HTS', + BigInt.fromI32(8) + ) + staticDefinitions.push(tokenWETH) + } return staticDefinitions } diff --git a/subgraphs/saucerswap/v1/src/types/utils/constants.ts b/subgraphs/saucerswap/v1/src/utils/constants.ts similarity index 100% rename from subgraphs/saucerswap/v1/src/types/utils/constants.ts rename to subgraphs/saucerswap/v1/src/utils/constants.ts diff --git a/subgraphs/saucerswap/v1/subgraph.yaml b/subgraphs/saucerswap/v1/subgraph.yaml index 09b44af..0c73ede 100644 --- a/subgraphs/saucerswap/v1/subgraph.yaml +++ b/subgraphs/saucerswap/v1/subgraph.yaml @@ -6,11 +6,11 @@ schema: dataSources: - kind: ethereum/contract name: Factory - network: mainnet + network: testnet source: - address: "0x0000000000000000000000000000000000103780" + address: "0x00000000000000000000000000000000000026e7" abi: Factory - startBlock: 35164593 + startBlock: 3354 mapping: kind: ethereum/events apiVersion: 0.0.4 @@ -34,7 +34,7 @@ dataSources: templates: - kind: ethereum/contract name: Pair - network: mainnet + network: testnet source: abi: Pair mapping: