Skip to content

Commit

Permalink
removing generated files to keep repo cleaner. these files are create…
Browse files Browse the repository at this point in the history
…d from the ABIs on compile (codegen) task

and cleanup

Signed-off-by: Alfredo Gutierrez <[email protected]>
  • Loading branch information
AlfredoG87 committed Apr 26, 2024
1 parent 5330a10 commit 8b48b86
Show file tree
Hide file tree
Showing 10 changed files with 112 additions and 65 deletions.
10 changes: 10 additions & 0 deletions subgraphs/saucerswap/v1/.env.mainnet
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions subgraphs/saucerswap/v1/.env.testnet
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion subgraphs/saucerswap/v1/src/mappings/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
2 changes: 1 addition & 1 deletion subgraphs/saucerswap/v1/src/mappings/dayUpdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion subgraphs/saucerswap/v1/src/mappings/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion subgraphs/saucerswap/v1/src/mappings/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
2 changes: 1 addition & 1 deletion subgraphs/saucerswap/v1/src/mappings/pricing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
139 changes: 83 additions & 56 deletions subgraphs/saucerswap/v1/src/mappings/tokenDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -23,76 +34,92 @@ export class TokenDefinition {
let staticDefinitions = new Array<TokenDefinition>(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
}
Expand Down
8 changes: 4 additions & 4 deletions subgraphs/saucerswap/v1/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -34,7 +34,7 @@ dataSources:
templates:
- kind: ethereum/contract
name: Pair
network: mainnet
network: testnet
source:
abi: Pair
mapping:
Expand Down

0 comments on commit 8b48b86

Please sign in to comment.