Skip to content

Commit

Permalink
fix: pool id
Browse files Browse the repository at this point in the history
  • Loading branch information
TbIKoBKa committed Oct 25, 2023
1 parent 581606e commit e53c32e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/adaptors/primex-finance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const formatPool = async (bucket, config, EPMXPrice) => {
sdk.api.abi.call({
abi: abi.activityRewardDistributorBuckets,
target: activityRewardDistributor,
chain,
chain: chain.toLowerCase(),
params: [bucketAddress, r]
})
)
Expand All @@ -25,12 +25,12 @@ const formatPool = async (bucket, config, EPMXPrice) => {
const symbol = asset.symbol
const underlyingTokens = [asset.tokenAddress]

const priceKeys = underlyingTokens.map((t) => `${chain}:${t}`).join(',')
const priceKeys = underlyingTokens.map((t) => `${chain.toLowerCase()}:${t}`).join(',')
const prices = (
await superagent.get(`https://coins.llama.fi/prices/current/${priceKeys}`)
).body.coins;

const assetPrice = prices[`${chain}:${asset.tokenAddress}`]
const assetPrice = prices[`${chain.toLowerCase()}:${asset.tokenAddress}`]
const totalSupplyUsd = (supply / 10 ** assetPrice.decimals) * assetPrice.price
const totalBorrowUsd = (demand / 10 ** assetPrice.decimals) * assetPrice.price
const tvlUsd = totalSupplyUsd - totalBorrowUsd
Expand All @@ -50,7 +50,7 @@ const formatPool = async (bucket, config, EPMXPrice) => {
const apyRewardBorrow = isMiningPhase ? 0 : apyRewardBorrowCalculated

return {
pool: bucketAddress,
pool: `${bucketAddress}-${chain}`.toLowerCase(),
chain,
project: 'primex-finance',
symbol,
Expand All @@ -74,14 +74,14 @@ const getPools = async (config) => {
await sdk.api.abi.call({
abi: abi.getAllBucketsFactory,
target: lensAddress,
chain,
chain: chain.toLowerCase(),
params: [bucketsFactory, DEAD_ADDRESS, positionManager, false]
})).output

const EPMXPrice = (await sdk.api.abi.call({
abi: abi.getChainlinkLatestRoundData,
target: lensAddress,
chain,
chain: chain.toLowerCase(),
params: [[EPMXPriceFeed]]
})).output[0].answer / 10 ** EPMXPriceFeedDecimals

Expand Down
4 changes: 2 additions & 2 deletions src/adaptors/primex-finance/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const ROLES = {
}

const CHAIN_IDS = {
polygon: 137,
Polygon: 137,
};

const APYREWARD_BY_SYMBOL = {
Expand All @@ -22,7 +22,7 @@ const APY_BASE_MINING = 7;

const config = [
{
chain: 'polygon',
chain: 'Polygon',
lensAddress: '0xA37a23C5Eb527985caae2a710a0F0De7C49ACb9d',
bucketsFactory: '0x7E6915D307F434E4171cCee90e180f5021c60089',
positionManager: '0x02bcaA4633E466d151b34112608f60A82a4F6035',
Expand Down

0 comments on commit e53c32e

Please sign in to comment.