Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
g1nt0ki committed Aug 5, 2024
1 parent a7c20b6 commit 25a43ef
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions projects/meso-finance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ let _poolData

function getPoolData() {
if (!_poolData) {
_poolData = new Promise(async (resolve, reject) => {
try {
const poolAddresses = await getPoolAddresses()
const poolInfos = await Promise.all(poolAddresses.map(getPoolInfo))
resolve(poolInfos)
} catch (e) { reject(e) }
})
_poolData = new Promise(fetchPoolData)
}

return _poolData

async function fetchPoolData(resolve, reject) {
try {
const poolAddresses = await getPoolAddresses()
const poolInfos = await Promise.all(poolAddresses.map(getPoolInfo))
resolve(poolInfos)
} catch (e) { reject(e) }
}

async function getPoolAddresses() {
const pools = await function_view({ functionStr: "0x68476f9d437e3f32fd262ba898b5e3ee0a23a1d586a6cf29a28add35f253f6f7::meso::pools" })
return pools[0]['data'].map(obj => { return { coin: obj.key, poolAddress: obj.value.inner } })
Expand Down

0 comments on commit 25a43ef

Please sign in to comment.