Skip to content

Commit

Permalink
Fix position issue in Mainnet (#49)
Browse files Browse the repository at this point in the history
* Fix position issue in mainnet

* Fix deps
  • Loading branch information
Rickk137 authored Oct 30, 2024
1 parent c7bbd78 commit 93e6ddd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,13 @@ async function getPythFeedIdsFromCollateralList(
}

export const getPriceUpdates = async (priceIds: string[], network: Network) => {
if (!priceIds.length) {
return null;
}
const unique = Array.from(new Set(priceIds));
const signedOffchainData = await priceService.getPriceFeedsUpdateData(unique);
const PythVerfier = await importPythVerfier(network.id, network.preset);

return {
to: PythVerfier.address,
data: new ethers.utils.Interface(PythVerfier.abi).encodeFunctionData('updatePriceFeeds', [
Expand Down
1 change: 1 addition & 0 deletions liquidity/lib/withERC7412/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"@pythnetwork/pyth-evm-js": "^1.42.0",
"@snx-v3/constants": "workspace:*",
"@snx-v3/contracts": "workspace:*",
"@snx-v3/tsHelpers": "workspace:*",
"@snx-v3/useBlockchain": "workspace:*",
"ethers": "^5.7.2"
}
Expand Down
3 changes: 2 additions & 1 deletion liquidity/lib/withERC7412/withERC7412.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
importPythERC7412Wrapper,
importPythVerfier,
} from '@snx-v3/contracts';
import { notNil } from '@snx-v3/tsHelpers';
import { Network, deploymentHasERC7412, getMagicProvider } from '@snx-v3/useBlockchain';
import { ethers } from 'ethers';

Expand Down Expand Up @@ -343,7 +344,7 @@ export async function erc7412Call<T>(
const from = getDefaultFromAddress(network.name);
const newCall = await withERC7412(
network,
calls.map((call) => (call.from ? call : { ...call, from })), // fill missing "from"
calls.filter(notNil).map((call) => (call.from ? call : { ...call, from })), // fill missing "from"
label,
from
);
Expand Down
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6357,6 +6357,7 @@ __metadata:
"@pythnetwork/pyth-evm-js": "npm:^1.42.0"
"@snx-v3/constants": "workspace:*"
"@snx-v3/contracts": "workspace:*"
"@snx-v3/tsHelpers": "workspace:*"
"@snx-v3/useBlockchain": "workspace:*"
ethers: "npm:^5.7.2"
languageName: unknown
Expand Down

0 comments on commit 93e6ddd

Please sign in to comment.