Skip to content

Commit c195854

Browse files
committed
Merge remote-tracking branch 'origin/develop'
2 parents e42dbcd + 1294e3a commit c195854

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

packages/core/src/data-centralization/types.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import mongoose from "mongoose";
22

3-
interface IPool {
3+
export interface IPool {
44
_id: mongoose.ObjectId
55
poolAddress: string;
66
owner: string;
@@ -29,7 +29,7 @@ interface IPool {
2929
createdAt: Date
3030
};
3131

32-
const PoolSchema = new mongoose.Schema<IPool>({
32+
export const PoolSchema = new mongoose.Schema<IPool>({
3333
poolAddress: {
3434
type: String,
3535
required: true,
@@ -141,8 +141,6 @@ const PoolSchema = new mongoose.Schema<IPool>({
141141
}
142142
});
143143

144-
export const PoolModel = mongoose.models.Pool || mongoose.model<IPool>('Pool', PoolSchema);
145-
146144
export type BaseInfo = {
147145
poolAddress: string;
148146
owner: string;

packages/core/src/data-centralization/updatePoolInDB.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
import mongoose from 'mongoose';
12
import { formatEther } from 'ethers';
23
import { getPoolInfo } from "./getPoolInfo.js";
3-
import { PoolModel } from "./types.js";
44
import { getMaxStakeAmountPerLicense } from "./getMaxStakeAmountPerLicense.js";
55
import { getTierIndexByStakedAmount } from "./getTierIndexByStakedAmount.js";
6+
import { IPool, PoolSchema } from './types.js';
67
import { config } from "../config.js";
78

89
const POOL_SHARES_BASE = 10_000;
@@ -15,6 +16,8 @@ export async function updatePoolInDB(
1516
poolAddress: string
1617
): Promise<void> {
1718

19+
const PoolModel = mongoose.models.Pool || mongoose.model<IPool>('Pool', PoolSchema);
20+
1821
//Load poolInfo from blockchain
1922
const poolInfo = await getPoolInfo(poolAddress);
2023
const baseInfo = poolInfo.baseInfo;

0 commit comments

Comments
 (0)