Created
September 29, 2021 02:43
-
-
Save jrhea/43dd9f6649c953ad8d82e786dd6c1a3e to your computer and use it in GitHub Desktop.
This gist returns the addresses of the Element Yield Token Pools (aka weighted pools)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const https = require('https'); | |
const url = | |
"https://raw.githubusercontent.com/element-fi/elf-deploy/main/addresses/mainnet.json"; | |
let wpAddresses = []; | |
https | |
.get(url, (res) => { | |
let body = ""; | |
res.on("data", (chunk) => { | |
body += chunk; | |
}); | |
res.on("end", () => { | |
try { | |
const json = JSON.parse(body); | |
for (const trancheListKey in json["tranches"]) { | |
const trancheList = json["tranches"][trancheListKey]; | |
for (const tranche of trancheList) { | |
wpAddresses.push(tranche.ytPool.address); | |
} | |
} | |
console.log(wpAddresses) | |
} catch (error) { | |
console.error(error.message); | |
} | |
}); | |
}) | |
.on("error", (error) => { | |
console.error(error.message); | |
}); |
Author
jrhea
commented
Sep 29, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment