Skip to content

Commit

Permalink
fn rename
Browse files Browse the repository at this point in the history
  • Loading branch information
iamamitkumar0512 committed Aug 5, 2024
1 parent b9fe82c commit c7b65bf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import {
getLiquidationPrice,
getNetProfitOrLossInCollateral,
getOrderManagerInstance,
getPositionId,
getExpectedPoitionIdFromNounce,
getProfitOrLossInUsd,
getUserPositionId,
getUserExpectedPoitionId,
getUserPositionNonce,
isPositionLiquidatable,
liquidatePositionUsingGelato,
Expand Down Expand Up @@ -460,12 +460,12 @@ export class Core {
return await getTotalOpenInterestInUsd(subgraphEndpoint, pythClient);
};

getPoitionId = (userAddress: string, positionNonce: BigInt, chain: Chain): string => {
return getPositionId(userAddress, positionNonce, chain);
getExpectedPoitionIdFromNounce = (userAddress: string, positionNonce: BigInt, chain: Chain): string => {
return getExpectedPoitionIdFromNounce(userAddress, positionNonce, chain);
};

getUserPoitionId = async (userAddress: string, chain: Chain): Promise<string | null> => {
return await getUserPositionId(userAddress, chain);
getUserExpectedPoitionId = async (userAddress: string, chain: Chain): Promise<string | null> => {
return await getUserExpectedPoitionId(userAddress, chain);
};

getUserPositionNonce = async (userAddress: string, chain: Chain): Promise<BigInt | null> => {
Expand Down
6 changes: 3 additions & 3 deletions src/core/order-manager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ export const calculateSizeFromCollateral = (
* @returns The computed position ID as a hex string.
*/

export const getPositionId = (userAddress: string, positionNonce: BigInt, chainId: number): string => {
export const getExpectedPoitionIdFromNounce = (userAddress: string, positionNonce: BigInt, chainId: number): string => {
const AbiCoder = new ethers.AbiCoder();
return ethers.keccak256(
AbiCoder.encode(['string', 'address', 'uint256', 'uint256'], ['POS', userAddress, positionNonce, chainId]),
Expand Down Expand Up @@ -674,10 +674,10 @@ export const getUserPositionNonce = async (userAddress: string, chain: Chain): P
* @returns A Promise that resolves to the position ID as a string, or null if an error occurs.
*/

export const getUserPositionId = async (userAddress: string, chain: Chain): Promise<string | null> => {
export const getUserExpectedPoitionId = async (userAddress: string, chain: Chain): Promise<string | null> => {
const userPositionNonce = await getUserPositionNonce(userAddress, chain);
if (userPositionNonce !== null) {
return getPositionId(userAddress, userPositionNonce, chain); // Assuming chain has an id property
return getExpectedPoitionIdFromNounce(userAddress, userPositionNonce, chain); // Assuming chain has an id property
}
return null;
};

0 comments on commit c7b65bf

Please sign in to comment.