Skip to content

Commit

Permalink
Simplifying fetchPriceData logic
Browse files Browse the repository at this point in the history
  • Loading branch information
pgbrandao committed Dec 29, 2023
1 parent 49a77cc commit feddc69
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 45 deletions.
10 changes: 1 addition & 9 deletions core/src/asset-strategies/AaveV2DepositStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,11 @@ export class AaveV2DepositStrategy extends InterfaceStrategy {
fetchPriceData({ provider, assetStore, asset }: FetchPriceDataParams) {
const linkedAsset = assetStore.getAssetById(asset.linkedAssets[0].assetId);

let requestTree: RequestTree = {};

requestTree[asset.address] = {};

const fetchedData = fetchPriceData({
const requestTree: RequestTree = fetchPriceData({
provider,
assetStore,
asset: linkedAsset,
});
requestTree = {
...requestTree,
...fetchedData,
};
return requestTree;
}

Expand Down
10 changes: 1 addition & 9 deletions core/src/asset-strategies/AaveV3DepositStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,11 @@ export class AaveV3DepositStrategy extends InterfaceStrategy {
fetchPriceData({ provider, assetStore, asset }: FetchPriceDataParams) {
const linkedAsset = assetStore.getAssetById(asset.linkedAssets[0].assetId);

let requestTree: RequestTree = {};

requestTree[asset.address] = {};

const fetchedData = fetchPriceData({
const requestTree: RequestTree = fetchPriceData({
provider,
assetStore,
asset: linkedAsset,
});
requestTree = {
...requestTree,
...fetchedData,
};
return requestTree;
}

Expand Down
10 changes: 1 addition & 9 deletions core/src/asset-strategies/CompoundV3DepositStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,11 @@ export class CompoundDepositStrategy extends InterfaceStrategy {
fetchPriceData({ provider, assetStore, asset }: FetchPriceDataParams) {
const linkedAsset = assetStore.getAssetById(asset.linkedAssets[0].assetId);

let requestTree: RequestTree = {};

requestTree[asset.address] = {};

const fetchedData = fetchPriceData({
const requestTree: RequestTree = fetchPriceData({
provider,
assetStore,
asset: linkedAsset,
});
requestTree = {
...requestTree,
...fetchedData,
};
return requestTree;
}

Expand Down
10 changes: 1 addition & 9 deletions core/src/asset-strategies/SavingsDaiDepositStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,11 @@ export class SavingsDaiDepositStrategy extends InterfaceStrategy {
fetchPriceData({ provider, assetStore, asset }: FetchPriceDataParams) {
const linkedAsset = assetStore.getAssetById(asset.linkedAssets[0].assetId);

let requestTree: RequestTree = {};

requestTree[asset.address] = {};

const fetchedData = fetchPriceData({
const requestTree: RequestTree = fetchPriceData({
provider,
assetStore,
asset: linkedAsset,
});
requestTree = {
...requestTree,
...fetchedData,
};
return requestTree;
}

Expand Down
10 changes: 1 addition & 9 deletions core/src/asset-strategies/YearnDepositStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,11 @@ export class YearnDepositStrategy extends InterfaceStrategy {
fetchPriceData({ provider, assetStore, asset }: FetchPriceDataParams) {
const linkedAsset = assetStore.getAssetById(asset.linkedAssets[0].assetId);

let requestTree: RequestTree = {};

requestTree[asset.address] = {};

const fetchedData = fetchPriceData({
const requestTree: RequestTree = fetchPriceData({
provider,
assetStore,
asset: linkedAsset,
});
requestTree = {
...requestTree,
...fetchedData,
};
return requestTree;
}

Expand Down

0 comments on commit feddc69

Please sign in to comment.