Skip to content

Commit

Permalink
fix: Update product price calculation in ProductService
Browse files Browse the repository at this point in the history
  • Loading branch information
suk-6 committed Sep 26, 2024
1 parent fdae4b9 commit e8f9677
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/modules/product/product.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ export class ProductService {
private readonly configService: ConfigService<{
S3_PUBLIC_URL: string;
}>,
) {}
) {
this.updateProductPrice('324fefab-fdd3-4a64-8a90-e6cb94b19b41');
}

async createProduct(userId: string, dto: CreateProductDTO) {
const product = await this.prisma.$transaction(
Expand Down Expand Up @@ -669,9 +671,7 @@ export class ProductService {
const S = product.fundingLog.filter((log) => log.type === FundingType.WITHDRAW).length; // 매도 요청
const L = 1000 - (await this.blockchain.getRemainingTokens(product.tokenAddress)); // 시장에 풀린 토큰

const newPrice = product.startAmount * (1 + 0.05 * (D - S / S + L));

console.log(newPrice);
const newPrice = product.startAmount * (1 + 0.05 * ((D - S) / (S + L)));

return this.prisma.product.update({
where: {
Expand Down

0 comments on commit e8f9677

Please sign in to comment.