diff --git a/projects/rocky/config.js b/projects/rocky/config.js new file mode 100644 index 0000000000..5e5053d9d9 --- /dev/null +++ b/projects/rocky/config.js @@ -0,0 +1,11 @@ + +const config = { + sei: { + address: "0x7b90821232074285a9ee9bee868bcc36231f8e32", + fromBlock: 175855916, + }, +} + +module.exports = { + config +} \ No newline at end of file diff --git a/projects/rocky/index.js b/projects/rocky/index.js new file mode 100644 index 0000000000..8de01cb442 --- /dev/null +++ b/projects/rocky/index.js @@ -0,0 +1,19 @@ +const {sumTokens2 } = require("../helper/unwrapLPs.js") +const { + config, + } = require("./config.js"); + +module.exports = { + methodology: `TVL is retrieved on-chain by getting the total assets managed by the Rocketizer contracts`, +}; + +async function tvl(api) { + const chainConfig = config[api.chain] + const {address: parallelizerAddress, fromBlock} = chainConfig + const collaterals = await api.call({ abi: 'address[]:getCollateralList', target: parallelizerAddress, block: fromBlock}) + return sumTokens2({ api, owner: parallelizerAddress, tokens: collaterals }) +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl } +});