Skip to content

Commit

Permalink
Merge pull request #14 from kleros/feat/support-tokenlist-kleros-eth
Browse files Browse the repository at this point in the history
feat: upload same list to tokenlist.kleros.eth
  • Loading branch information
jaybuidl committed Jun 21, 2024
2 parents 5303f80 + fe11544 commit 003729f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
9 changes: 6 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ CURATE_GRAPH_URL=https://api.studio.thegraph.com/query/61738/legacy-curate-gnosi
KLEROS_TOKENS_REGISTRY_ADDRESS=0xee1502e29795ef6c2d60f8d7120596abe3bad990

ENS_CONTRACT=0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e
ENS_TOKEN_LIST_NAME=t2crtokens.eth
ENS_T2CRTOKENS_NAME=t2crtokens.eth
ENS_TOKENLIST_NAME=tokenlist.kleros.eth

LATEST_TOKEN_LIST_URL=https://t2crtokens.eth.limo
LATEST_T2CRTOKENS_URL=https://t2crtokens.eth.limo
LATEST_TOKENLIST_URL=https://tokenlist.kleros.eth.limo

PROVIDER_URL=https://mainnet.infura.io/v3/<your-key>
IPFS_GATEWAY=https://cdn.kleros.link
Expand All @@ -13,4 +15,5 @@ WALLET_KEY=

# Optional. If not provided, 300 seconds (5 minutes will be used).
POLL_PERIOD_SECONDS=300

# Change to prod if want to remove debug logs
NODE_ENV=development
2 changes: 1 addition & 1 deletion src/erc20.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default async function checkPublishErc20(
console.info('List did not change.')
console.info(
'Latest list can be found at',
process.env.LATEST_TOKEN_LIST_URL,
listURL,
)
return
} else {
Expand Down
16 changes: 13 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,25 @@ async function main() {
}
}

// Publish fungible tokens
// Update tokens list in ENS (if needed)
await checkPublishErc20(
tokensWithLogo,
provider,
process.env.LATEST_TOKEN_LIST_URL,
process.env.ENS_TOKEN_LIST_NAME,
process.env.LATEST_T2CRTOKENS_URL,
process.env.ENS_T2CRTOKENS_NAME,
'Tokens',
't2cr.tokenlist.json',
)

// Update tokens list in ENS (if needed)
await checkPublishErc20(
tokensWithLogo,
provider,
process.env.LATEST_TOKENLIST_URL,
process.env.ENS_TOKENLIST_NAME,
'Tokens',
'tokenlist.tokenlist.json',
)
}

main().catch((err) => {
Expand Down
6 changes: 4 additions & 2 deletions src/types/environment.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ declare global {
KLEROS_TOKENS_REGISTRY_ADDRESS: string
PROVIDER_URL: string
POLL_PERIOD_SECONDS: string
LATEST_TOKEN_LIST_URL: string
LATEST_T2CRTOKENS_URL: string
LATEST_TOKENLIST_URL: string
IPFS_GATEWAY: string
WALLET_KEY: string
ENS_CONTRACT: string
ENS_TOKEN_LIST_NAME: string
ENS_T2CRTOKENS_NAME: string,
ENS_TOKENLIST_NAME: string
}
}
}

0 comments on commit 003729f

Please sign in to comment.