Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Metroxe committed Apr 11, 2024
2 parents e42dbcd + 1294e3a commit c195854
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 2 additions & 4 deletions packages/core/src/data-centralization/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import mongoose from "mongoose";

interface IPool {
export interface IPool {
_id: mongoose.ObjectId
poolAddress: string;
owner: string;
Expand Down Expand Up @@ -29,7 +29,7 @@ interface IPool {
createdAt: Date
};

const PoolSchema = new mongoose.Schema<IPool>({
export const PoolSchema = new mongoose.Schema<IPool>({
poolAddress: {
type: String,
required: true,
Expand Down Expand Up @@ -141,8 +141,6 @@ const PoolSchema = new mongoose.Schema<IPool>({
}
});

export const PoolModel = mongoose.models.Pool || mongoose.model<IPool>('Pool', PoolSchema);

export type BaseInfo = {
poolAddress: string;
owner: string;
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/data-centralization/updatePoolInDB.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import mongoose from 'mongoose';
import { formatEther } from 'ethers';
import { getPoolInfo } from "./getPoolInfo.js";
import { PoolModel } from "./types.js";
import { getMaxStakeAmountPerLicense } from "./getMaxStakeAmountPerLicense.js";
import { getTierIndexByStakedAmount } from "./getTierIndexByStakedAmount.js";
import { IPool, PoolSchema } from './types.js';
import { config } from "../config.js";

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

const PoolModel = mongoose.models.Pool || mongoose.model<IPool>('Pool', PoolSchema);

//Load poolInfo from blockchain
const poolInfo = await getPoolInfo(poolAddress);
const baseInfo = poolInfo.baseInfo;
Expand Down

0 comments on commit c195854

Please sign in to comment.