Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add toc for docs website. #1021

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/deployed-addresses/1-assets-3.0.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
| fUSDT | [0xbe6Fb2b2908D85179e34ee0D996e32fa2BF4410A](https://etherscan.io/address/0xbe6Fb2b2908D85179e34ee0D996e32fa2BF4410A) |
| fDAI | [0x33C1665Eb1b3673213Daa5f068ae1026fC8D5875](https://etherscan.io/address/0x33C1665Eb1b3673213Daa5f068ae1026fC8D5875) |
| fFRAX | [0xaAeF84f6FfDE4D0390E14DA9c527d1a1ABf28B92](https://etherscan.io/address/0xaAeF84f6FfDE4D0390E14DA9c527d1a1ABf28B92) |
| cUSDCv3 | [0x85b256e9051B781A0BC0A987857AD6166C94040a](https://etherscan.io/address/0x85b256e9051B781A0BC0A987857AD6166C94040a) |
| cUSDCv3 | [0x7Dee4DbeF75f93cCA06823Ac915Df990be3F1538](https://etherscan.io/address/0x7Dee4DbeF75f93cCA06823Ac915Df990be3F1538) |
| cvx3Pool | [0x62C394620f674e85768a7618a6C202baE7fB8Dd1](https://etherscan.io/address/0x62C394620f674e85768a7618a6C202baE7fB8Dd1) |
| cvxeUSDFRAXBP | [0x890FAa00C16EAD6AA76F18A1A7fe9C40838F9122](https://etherscan.io/address/0x890FAa00C16EAD6AA76F18A1A7fe9C40838F9122) |
| cvxMIM3Pool | [0xCBE084C44e7A2223F76362Dcc4EbDacA5Fb1cbA7](https://etherscan.io/address/0xCBE084C44e7A2223F76362Dcc4EbDacA5Fb1cbA7) |
Expand All @@ -52,4 +52,5 @@
| maWETH | [0x878b995bDD2D9900BEE896Bd78ADd877672e1637](https://etherscan.io/address/0x878b995bDD2D9900BEE896Bd78ADd877672e1637) |
| maStETH | [0x33E840e5711549358f6d4D11F9Ab2896B36E9822](https://etherscan.io/address/0x33E840e5711549358f6d4D11F9Ab2896B36E9822) |
| aEthUSDC | [0x12c3BB1B0da85fDaE0137aE8fDe901F7D0e106ba](https://etherscan.io/address/0x12c3BB1B0da85fDaE0137aE8fDe901F7D0e106ba) |
| sFRAX | [0x7E4650af145f6a9146b91E8b363DF49ee32b0A58](https://etherscan.io/address/0x7E4650af145f6a9146b91E8b363DF49ee32b0A58) |

2 changes: 1 addition & 1 deletion docs/deployed-addresses/8453-assets-3.0.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
| WETH | [0x42D0fA25d6d5bff01aC050c0F5aB0B2C9D01b4a3](https://basescan.org/address/0x42D0fA25d6d5bff01aC050c0F5aB0B2C9D01b4a3) |
| USDbC | [0x6490D66B17A1E9a460Ab54131165C8F921aCcDeB](https://basescan.org/address/0x6490D66B17A1E9a460Ab54131165C8F921aCcDeB) |
| cbETH | [0x5fE248625aC2AB0e17A115fef288f17AF1952402](https://basescan.org/address/0x5fE248625aC2AB0e17A115fef288f17AF1952402) |
| cUSDbCv3 | [0xa372EC846131FBf9AE8b589efa3D041D9a94dF41](https://basescan.org/address/0xa372EC846131FBf9AE8b589efa3D041D9a94dF41) |
| cUSDbCv3 | [0xd3025304C6487FC5c39010bEA0B46cc0690ab229](https://basescan.org/address/0xd3025304C6487FC5c39010bEA0B46cc0690ab229) |
| aBasUSDbC | [0x1DdB7dfdC5D26FE1f2aD02d9972f12481346Ae9b](https://basescan.org/address/0x1DdB7dfdC5D26FE1f2aD02d9972f12481346Ae9b) |
| wsgUSDbC | [0x15395aCCbF8c6b28671fe41624D599624709a2D6](https://basescan.org/address/0x15395aCCbF8c6b28671fe41624D599624709a2D6) |

36 changes: 36 additions & 0 deletions docs/deployed-addresses/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"mainnet": {
"components": [
"components-2.0.0",
"components-2.1.0",
"components-3.0.0",
"components-3.0.1"
],
"assets": [
"assets-2.0.0",
"assets-2.1.0",
"assets-3.0.0",
"assets-3.0.1"
],
"rtokens": [
"eUSD",
"ETH+",
"hyUSD",
"USDC+"
]
},
"base": {
"components": [
"components-3.0.0",
"components-3.0.1"
],
"assets": [
"assets-3.0.0",
"assets-3.0.1"
],
"rtokens": [
"hyUSD",
"Vaya"
]
}
}
58 changes: 41 additions & 17 deletions tasks/deployment/get-addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,29 @@ import {
import { ITokens } from '#/common/configuration'
import { MainP1 } from '@typechain/MainP1'
import { Contract } from 'ethers'
const tocFilename = 'docs/deployed-addresses/index.json'
import toc from '#/docs/deployed-addresses/index.json'

type Network = 'mainnet' | 'base'

task('get-addys', 'Compile the deployed addresses of an RToken deployment')
.addOptionalParam('rtoken', 'The address of the RToken', undefined, types.string)
.addOptionalParam('gov', 'The address of the RToken Governance', undefined, types.string)
.addOptionalParam('ver', 'The target version', undefined, types.string)
.setAction(async (params, hre) => {
/*
Helper functions
Helper functions
*/

// hacky api throttler, basescan has rate limits 5req/sec
const delay = async (ms: number) => {
return new Promise( resolve => setTimeout(resolve, ms) );
// hacky api throttler, basescan has rate limits 5req/sec
const delay = async (ms: number) => {
return new Promise( resolve => setTimeout(resolve, ms) );
}

const capitalize = (s: string) => s && s[0].toUpperCase() + s.slice(1)

const network = hre.network.name

const chainId = await getChainId(hre)
const network: Network = hre.network.name as Network
let scannerUrl: string;
let scannerApiUrl: string;
switch(network) {
Expand Down Expand Up @@ -147,20 +152,25 @@ ${collaterals}
}

const getRTokenFileName = async (rtoken: string) => {
const chainId = await getChainId(hre)
const rToken = await hre.ethers.getContractAt('IRToken', rtoken)
const rTokenSymbol = await rToken.symbol()
return `${outputDir}${chainId}-${rTokenSymbol}.md`
}

const getAssetFileName = async (version: string) => {
const chainId = await getChainId(hre)
return `${outputDir}${chainId}-assets-${version}.md`
const getAssetFileId = (version: string) => {
return `assets-${version}`
}

const getComponentFileName = async (version: string) => {
const chainId = await getChainId(hre)
return `${outputDir}${chainId}-components-${version}.md`
const getComponentFileId = (version: string) => {
return `components-${version}`
}

const getAssetFileName = (assetFileId: string) => {
return `${outputDir}${chainId}-${assetFileId}.md`
}

const getComponentFileName = (componentFileId: string) => {
return `${outputDir}${chainId}-${componentFileId}.md`
}

/*
Expand Down Expand Up @@ -229,6 +239,11 @@ ${collaterals}
const rTokenFileName = await getRTokenFileName(params.rtoken)
fs.writeFileSync(rTokenFileName, markdown)
console.log(`Wrote ${rTokenFileName}`)

toc[network]['rtokens'].indexOf(rTokenSymbol) === -1 && toc[network]['rtokens'].push(rTokenSymbol)
fs.writeFileSync(tocFilename, JSON.stringify(toc, null, 2))
console.log(`Updated table of contents`)

} else if (params.ver) {
console.log(`Collecting addresses for Version: ${params.ver} (${hre.network.name})`)
// if version is provided, print implementation addresses
Expand All @@ -254,7 +269,9 @@ ${collaterals}
assetRows,
collateralRows
)
const assetFileName = await getAssetFileName(params.ver)
const assetFileId = getAssetFileId(params.ver)
const assetFileName = getAssetFileName(assetFileId)

fs.writeFileSync(assetFileName, assetMarkdown)
console.log(`Wrote ${assetFileName}`)

Expand Down Expand Up @@ -283,9 +300,16 @@ ${collaterals}
`Component Implementations (${capitalize(hre.network.name)} ${params.ver})`,
await createTableRows(components, false, true)
)
const componentFileName = await getComponentFileName(params.ver)

const componentFileId = getComponentFileId(params.ver)
const componentFileName = getComponentFileName(componentFileId)
fs.writeFileSync(componentFileName, componentMarkdown)
console.log(`Wrote ${componentFileName}`)

toc[network]['components'].indexOf(componentFileId) === -1 && toc[network]['components'].push(componentFileId)
toc[network]['assets'].indexOf(assetFileId) === -1 && toc[network]['assets'].push(assetFileId)
fs.writeFileSync(tocFilename, JSON.stringify(toc, null, 2))
console.log(`Updated table of contents`)
} else {
// if neither rtoken address nor version number is provided, throw error
throw new Error(
Expand Down