Skip to content

Commit d87fbed

Browse files
authored
create token (#467)
1 parent d1844f4 commit d87fbed

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/mappings/factoryRouter.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { Pool } from '../@types/schema'
1616
import { BPool, FixedRateExchange, Dispenser } from '../@types/templates'
1717
import { addPool, getOPC, getTemplates } from './utils/globalUtils'
1818
import { weiToDecimal } from './utils/generic'
19+
import { getToken } from './utils/tokenUtils'
1920

2021
export function handleNewPool(event: NewPool): void {
2122
BPool.create(event.params.poolAddress)
@@ -74,8 +75,11 @@ export function handleTokenAdded(event: TokenAdded): void {
7475
let existingTokens: string[]
7576
if (!opc.approvedTokens) existingTokens = []
7677
else existingTokens = opc.approvedTokens as string[]
77-
if (!existingTokens.includes(event.params.token.toHexString()))
78-
existingTokens.push(event.params.token.toHexString())
78+
if (!existingTokens.includes(event.params.token.toHexString())) {
79+
const newToken = getToken(event.params.token, false)
80+
existingTokens.push(newToken.id)
81+
}
82+
7983
opc.approvedTokens = existingTokens
8084

8185
opc.save()

0 commit comments

Comments
 (0)