-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3813518
commit d2e5acf
Showing
11 changed files
with
95 additions
and
21 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { getCowApys } from '../common/getCowVaultApys'; | ||
|
||
export const getBeefyCowRootstockApys = async () => { | ||
return await getCowApys('rootstock'); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { getBeefyCowcentratedVaultPrices } from '../common/getBeefyCowcentratedVaultPrices'; | ||
|
||
export const getBeefyCowRootstockPrices = async tokenPrices => { | ||
return await getBeefyCowcentratedVaultPrices('rootstock', tokenPrices); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
const { getBeefyCowRootstockApys } = require('./getBeefyCowRootstockApys'); | ||
|
||
const getApys = [getBeefyCowRootstockApys]; | ||
|
||
const getRootstockApys = async () => { | ||
const start = Date.now(); | ||
let apys = {}; | ||
let apyBreakdowns = {}; | ||
|
||
let promises = []; | ||
getApys.forEach(getApy => promises.push(getApy())); | ||
const results = await Promise.allSettled(promises); | ||
|
||
for (const result of results) { | ||
if (result.status !== 'fulfilled') { | ||
console.warn('getRootstockApys error', result.reason); | ||
continue; | ||
} | ||
|
||
// Set default APY values | ||
let mappedApyValues = result.value; | ||
let mappedApyBreakdownValues = {}; | ||
|
||
// Loop through key values and move default breakdown format | ||
// To require totalApy key | ||
for (const [key, value] of Object.entries(result.value)) { | ||
mappedApyBreakdownValues[key] = { | ||
totalApy: value, | ||
}; | ||
} | ||
|
||
// Break out to apy and breakdowns if possible | ||
let hasApyBreakdowns = 'apyBreakdowns' in result.value; | ||
if (hasApyBreakdowns) { | ||
mappedApyValues = result.value.apys; | ||
mappedApyBreakdownValues = result.value.apyBreakdowns; | ||
} | ||
|
||
apys = { ...apys, ...mappedApyValues }; | ||
|
||
apyBreakdowns = { ...apyBreakdowns, ...mappedApyBreakdownValues }; | ||
} | ||
|
||
const end = Date.now(); | ||
console.log(`> [APY] Sei finished updating in ${(end - start) / 1000}s`); | ||
|
||
return { | ||
apys, | ||
apyBreakdowns, | ||
}; | ||
}; | ||
|
||
module.exports = { getRootstockApys }; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[ | ||
{ | ||
"address": "0x7AB03a37822014f4aba762F0a622bF0cc8A32F47", | ||
"lpAddress": "0xCbA7aBe98fd6A65259837d76a3409841C1DD4288", | ||
"tokens": ["0x1D931Bf8656d795E50eF6D639562C5bD8Ac2B78f", "0x542fDA317318eBF1d3DEAf76E0b632741A7e677d"], | ||
"tokenOracleIds": ["WETH", "WBTC"], | ||
"decimals": [18, 18], | ||
"oracleId": "uniswap-cow-rootstock-eths-wrbtc", | ||
"rewardPool": { | ||
"address": "0xd9BcDF03D03D1F36d2B6dAf6b30b9eE6C014F610", | ||
"oracleId": "uniswap-cow-rootstock-eths-wrbtc-rp" | ||
} | ||
} | ||
] |