From 8eec7d51375f02bcf8ff4dc4eba54b756cb764ae Mon Sep 17 00:00:00 2001 From: Antonio Viggiano Date: Fri, 19 Jul 2024 03:19:50 -0300 Subject: [PATCH] Add SizeCredit (#11013) * Add SizeCredit * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/size-credit/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/size-credit/index.js diff --git a/projects/size-credit/index.js b/projects/size-credit/index.js new file mode 100644 index 000000000000..24b220db467d --- /dev/null +++ b/projects/size-credit/index.js @@ -0,0 +1,23 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') + +const AUSDC_CONTRACT = '0x4e65fe4dba92790696d040ac24aa414708f5c0ab' +const SZDEBT_CONTRACT = '0xb0a00c4b3d77c896f46dc6b204695e22de7a185d' +const SIZE_PROXY_CONTRACT = '0xC2a429681CAd7C1ce36442fbf7A4a68B11eFF940' +const tokens = [ + ADDRESSES.base.WETH, + AUSDC_CONTRACT, +] + +async function borrowed(api) { + const totalDebt = await api.call({ abi: 'erc20:totalSupply', target: SZDEBT_CONTRACT, }); + + return api.add(ADDRESSES.base.USDbC, totalDebt) +} + +module.exports = { + base: { + tvl: sumTokensExport({ tokens, owner: SIZE_PROXY_CONTRACT }), + borrowed + } +}