Skip to content

Commit

Permalink
refactor: refactor names
Browse files Browse the repository at this point in the history
  • Loading branch information
gidonkatten committed Oct 31, 2024
1 parent 113ddab commit 08e5164
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/chains/evm/hub/modules/folks-hub-rewards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import type {
import type { RewardsV1Abi } from "../constants/abi/rewards-v1-abi.js";
import type { HubChain } from "../types/chain.js";
import type { LoanTypeInfo } from "../types/loan.js";
import type { PoolsPoints, ActiveEpochs, PoolEpoch, UserPoolPoints } from "../types/rewards.js";
import type { PoolsPoints, ActiveEpochs, PoolEpoch, UserPoints } from "../types/rewards.js";
import type { HubTokenData } from "../types/token.js";
import type {
Client,
Expand Down Expand Up @@ -227,13 +227,13 @@ export async function getUnclaimedRewards(
return await rewardsV1.read.getUnclaimedRewards([accountId, poolEpochs]);
}

export async function getUserPoolPoints(
export async function getUserPoints(
provider: Client,
network: NetworkType,
accountId: AccountId,
loanIds: Array<LoanId>,
loanTypesInfo: Partial<Record<LoanTypeId, LoanTypeInfo>>,
): Promise<UserPoolPoints> {
): Promise<UserPoints> {
const hubChain = getHubChain(network);
const loanManager = getLoanManagerContract(provider, hubChain.loanManagerAddress);

Expand Down Expand Up @@ -273,7 +273,7 @@ export async function getUserPoolPoints(
const folksTokenId = folksTokenIds[i];
rewards[folksTokenId] = accountPoolReward;
}
const userRewards: UserPoolPoints = { accountId, poolsPoints: rewards };
const userRewards: UserPoints = { accountId, poolsPoints: rewards };

// add all the rewards which are not updated
const userLoans = await getUserLoans(provider, network, loanIds);
Expand Down
2 changes: 1 addition & 1 deletion src/chains/evm/hub/types/rewards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export type PoolsPoints = {
interestPaid: bigint;
};

export type UserPoolPoints = {
export type UserPoints = {
accountId: AccountId;
poolsPoints: Partial<Record<FolksTokenId, PoolsPoints>>;
};
8 changes: 4 additions & 4 deletions src/xchain/modules/folks-rewards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { FolksCore } from "../core/folks-core.js";

import type { PrepareUpdateUserPointsInLoans } from "../../chains/evm/common/types/index.js";
import type { LoanTypeInfo } from "../../chains/evm/hub/types/loan.js";
import type { ActiveEpochs, UserPoolPoints } from "../../chains/evm/hub/types/rewards.js";
import type { ActiveEpochs, UserPoints } from "../../chains/evm/hub/types/rewards.js";
import type { ChainType } from "../../common/types/chain.js";
import type { AccountId, LoanId } from "../../common/types/lending.js";
import type {
Expand Down Expand Up @@ -129,12 +129,12 @@ export const read = {
return getUnclaimedRewards(FolksCore.getHubProvider(), FolksCore.getSelectedNetwork(), accountId, activeEpochs);
},

async userPoolPoints(
async userPoints(
accountId: AccountId,
loanIds: Array<LoanId>,
loanTypesInfo: Partial<Record<LoanTypeId, LoanTypeInfo>>,
): Promise<UserPoolPoints> {
return FolksHubRewards.getUserPoolPoints(
): Promise<UserPoints> {
return FolksHubRewards.getUserPoints(
FolksCore.getHubProvider(),
FolksCore.getSelectedNetwork(),
accountId,
Expand Down

0 comments on commit 08e5164

Please sign in to comment.