Skip to content

Commit d1bbeff

Browse files
committed
fix broken adapters
1 parent 92f7a22 commit d1bbeff

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

projects/helper/unwrapLPs.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,20 @@ async function unwrapUniswapV3NFTs({ balances = {}, nftsAndOwners = [], block, c
218218
return balances
219219
}
220220

221+
const factories = {}
222+
223+
const getFactoryKey = (chain, nftAddress) => `${chain}:${nftAddress}`.toLowerCase()
224+
221225
async function unwrapUniswapV3NFT({ balances, owner, nftAddress, block, chain = 'ethereum', blacklistedTokens = [], whitelistedTokens = [], uniV3ExtraConfig = {}, }) {
222226

223227
blacklistedTokens = getUniqueAddresses(blacklistedTokens, chain)
224228
whitelistedTokens = getUniqueAddresses(whitelistedTokens, chain)
225229
let nftIdFetcher = uniV3ExtraConfig.nftIdFetcher ?? nftAddress
226230

227231
const nftPositions = (await sdk.api.erc20.balanceOf({ target: nftIdFetcher, owner, block, chain })).output
228-
const factory = (await sdk.api.abi.call({ target: nftAddress, abi: wildCreditABI.factory, block, chain })).output
232+
const factoryKey = getFactoryKey(chain, nftAddress)
233+
if (!factories[factoryKey]) factories[factoryKey] = sdk.api.abi.call({ target: nftAddress, abi: wildCreditABI.factory, block, chain })
234+
const factory = (await factories[factoryKey]).output
229235

230236
const positionIds = (await sdk.api.abi.multiCall({
231237
block, chain, abi: wildCreditABI.tokenOfOwnerByIndex, target: nftIdFetcher,

projects/paraspace-ape-staking-v2/index.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,16 @@ async function tvl(_, _1, _cb, { api }) {
3333
const stakedAddress = [nBAYC, nMAYC, nBAKC, P2PPairStaking, cAPE];
3434

3535
const balances = {};
36+
const allStakes = []
37+
for (const stake of stakedAddress) {
38+
const stakeData = await api.call({
39+
target: ApeCoinStaking,
40+
params: stake,
41+
abi: abi.ApeCoinStaking.getAllStakes,
42+
});
43+
allStakes.push(stakeData);
44+
}
3645

37-
const allStakes = await api.multiCall({
38-
calls: stakedAddress,
39-
target: ApeCoinStaking,
40-
abi: abi.ApeCoinStaking.getAllStakes,
41-
});
4246
const otherPools = {}
4347
allStakes.flat().forEach(({ poolId, tokenId, deposited }) => {
4448
if (poolId === '0') {

0 commit comments

Comments
 (0)