Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
g1nt0ki committed Oct 18, 2024
1 parent 199d5db commit f1d66fd
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions projects/truemarkets/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const { getLogs2 } = require('../helper/cache/getLogs')
const { base } = require('../radiant-v2')

const config = {
base: { factory: '0x288025b60330e01d793B6e83c1a0dE22bb943459', fromBlock: 21180486 },
}

Object.keys(config).forEach(chain => {
const { factory, fromBlock } = config[chain]
module.exports[chain] = {
tvl: async (api) => {
const logs = await getLogs2({ api, factory, eventAbi: 'event MarketCreatedWithDescription (address marketAddress, string marketQuestion, string marketSource, string additionalInfo, uint256 endOfTrading, uint256 yesNoTokenCap, address marketOwner)', fromBlock, })
const markets = logs.map(log => log.marketAddress)
const tokens = await api.multiCall({ abi: 'address:paymentToken', calls: markets})
return api.sumTokens({ tokensAndOwners2: [tokens, markets]})
}
}
})

0 comments on commit f1d66fd

Please sign in to comment.