Skip to content

Instantly share code, notes, and snippets.

@jrhea
Created September 29, 2021 02:43
Show Gist options
  • Save jrhea/43dd9f6649c953ad8d82e786dd6c1a3e to your computer and use it in GitHub Desktop.
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)
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);
});
@jrhea
Copy link
Author

jrhea commented Sep 29, 2021

$ node wpAddresses.js 
[
  '0xD5D7bc115B32ad1449C6D0083E43C87be95F2809',
  '0x4212bE3C7b255bA4B29705573ABD023cdcE21542',
  '0xDe620bb8BE43ee54d7aa73f8E99A7409Fe511084',
  '0x67F8FCb9D3c463da05DE1392EfDbB2A87F8599Ea',
  '0xF94A7Df264A2ec8bCEef2cFE54d7cA3f6C6DFC7a',
  '0xE54B3F5c444a801e61BECDCa93e74CdC1C4C1F90',
  '0xB70c25D96EF260eA07F650037Bf68F5d6583885e',
  '0x2D6e3515C8b47192Ca3913770fa741d3C4Dac354',
  '0x9e030b67a8384cbba09D5927533Aa98010C87d91',
  '0xd16847480D6bc218048CD31Ad98b63CC34e5c2bF',
  '0x7320d680Ca9BCE8048a286f00A79A2c9f8DCD7b3',
  '0x802d0f2f4b5f1fb5BfC9b2040a703c1464e1D4CB'
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment