Skip to content

Commit

Permalink
chore: quick fix (#170)
Browse files Browse the repository at this point in the history
* chore: quick fix

* chore: remove node linker
  • Loading branch information
olgakonsta committed Jul 8, 2024
1 parent 81bf655 commit f80f1b2
Show file tree
Hide file tree
Showing 5 changed files with 248 additions and 381 deletions.
2 changes: 1 addition & 1 deletion stash-dev/src/repository/ChainRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const keyPool = (id: number) => PREFIX_POOL + id

const FIRST_POOL_BLOCK = 251216
const BLOCK_DECEMBER_2023 = 3_750_000 // 2 december 2023
const ROLLUP_STARTER_BLOCK = 80000
const ROLLUP_STARTER_BLOCK = 0 //8 July 2024
const BATCH = 300 * 12 * 1000 // ~= 1 hour of blocks

export const LIMIT = 10_000
Expand Down
2 changes: 1 addition & 1 deletion stash-dev/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const server = app.listen(app.get('port'), async () => {
const run = 1
while (run) {
await new Promise((f) => setTimeout(f, BLOCK_TIME * 10))
await poolRatesService.initService()
// await poolRatesService.initService()
await priceService.initService()
await volumeService.initService()
await tradesService.initService()
Expand Down
19 changes: 14 additions & 5 deletions stash-dev/src/service/SyncBlockService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,26 @@ import * as store from '../repository/ChainRepository.js'
import * as blocks from '../scraper/BlockScraper.js'
import * as pools from '../scraper/PoolsScraper.js'
import * as staking from '../scraper/StakingScraper.js'
import logger from '../util/Logger.js'

export const initService = async () => {
console.log('init service called')
const api = await MangataClient.api()

const latestBlock = (await store.getLatest()).block
// const latestBlock = 3719278
await blocks.withBlocks(api, latestBlock, async (block) => {
await blocks.processEvents(block)
await pools.fetchPools(block)
await staking.processStaking(api, block)
await staking.processLiquidStaking(api, block)
await store.saveLatest({ timestamp: block.timestamp, block: block.number })
try {
// await blocks.processEvents(block)
// await pools.fetchPools(block)
// await staking.processStaking(api, block)
// await staking.processLiquidStaking(api, block)
// await store.saveLatest({
// timestamp: block.timestamp,
// block: block.number,
// })
} catch (e) {
logger.error('Error in processing block: ', e)
}
})
}
4 changes: 2 additions & 2 deletions stash-dev/src/util/Chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Codec } from '@polkadot/types/types'
import { blake2AsHex } from '@polkadot/util-crypto'
import _ from 'lodash'

export const GETH = 5
export const KSM = 4
export const GETH = 1
export const KSM = 1
export const BASE_TOKEN = process.env.APP_ENV === 'rollup-dev' ? GETH : KSM

export type CodecOrArray = Codec | Codec[]
Expand Down
Loading

0 comments on commit f80f1b2

Please sign in to comment.