From 4c56ac0529b10b93604c536ffad2d3771c7195aa Mon Sep 17 00:00:00 2001 From: xiaoch05 Date: Wed, 11 Oct 2023 15:36:39 +0800 Subject: [PATCH] add protocol fee --- .../prisma/migrations/20231011073505_init/migration.sql | 8 ++++++++ apollo/prisma/schema.prisma | 1 + apollo/src/aggregation/aggregation.history.graphql | 1 + apollo/src/graphql.ts | 1 + apollo/src/lnbridgev20/lnbridgev20.service.ts | 6 ++++-- 5 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 apollo/prisma/migrations/20231011073505_init/migration.sql diff --git a/apollo/prisma/migrations/20231011073505_init/migration.sql b/apollo/prisma/migrations/20231011073505_init/migration.sql new file mode 100644 index 00000000..d0faf0ea --- /dev/null +++ b/apollo/prisma/migrations/20231011073505_init/migration.sql @@ -0,0 +1,8 @@ +/* + Warnings: + + - Added the required column `protocolFee` to the `Lnv20RelayInfo` table without a default value. This is not possible if the table is not empty. + +*/ +-- AlterTable +ALTER TABLE "Lnv20RelayInfo" ADD COLUMN "protocolFee" TEXT NOT NULL; diff --git a/apollo/prisma/schema.prisma b/apollo/prisma/schema.prisma index a28fb3b2..f2dfe5c2 100644 --- a/apollo/prisma/schema.prisma +++ b/apollo/prisma/schema.prisma @@ -65,6 +65,7 @@ model Lnv20RelayInfo { transaction_hash String timestamp Int margin String + protocolFee String baseFee String liquidityFeeRate Int slashCount Int diff --git a/apollo/src/aggregation/aggregation.history.graphql b/apollo/src/aggregation/aggregation.history.graphql index b37e68e1..042e35c0 100644 --- a/apollo/src/aggregation/aggregation.history.graphql +++ b/apollo/src/aggregation/aggregation.history.graphql @@ -57,6 +57,7 @@ type Lnv20RelayInfo { transaction_hash: String! timestamp: Int! margin: String + protocolFee: String baseFee: String liquidityFeeRate: Int slashCount: Int diff --git a/apollo/src/graphql.ts b/apollo/src/graphql.ts index 6784fcd6..4f5921f4 100644 --- a/apollo/src/graphql.ts +++ b/apollo/src/graphql.ts @@ -88,6 +88,7 @@ export class Lnv20RelayInfo { transaction_hash: string; timestamp: number; margin?: Nullable; + protocolFee?: Nullable; baseFee?: Nullable; liquidityFeeRate?: Nullable; slashCount?: Nullable; diff --git a/apollo/src/lnbridgev20/lnbridgev20.service.ts b/apollo/src/lnbridgev20/lnbridgev20.service.ts index 09c2cf08..5c7693ff 100644 --- a/apollo/src/lnbridgev20/lnbridgev20.service.ts +++ b/apollo/src/lnbridgev20/lnbridgev20.service.ts @@ -574,7 +574,8 @@ export class Lnbridgev20Service implements OnModuleInit { transaction_hash: record.transactionHash, timestamp: Number(record.timestamp), margin: '0', - baseFee: (BigInt(record.baseFee) + BigInt(symbol.protocolFee)).toString(), + protocolFee: BigInt(symbol.protocolFee).toString(), + baseFee: BigInt(record.baseFee).toString(), liquidityFeeRate: Number(record.liquidityFeeRate), slashCount: 0, targetNonce: 0, @@ -667,7 +668,8 @@ export class Lnbridgev20Service implements OnModuleInit { transaction_hash: record.transactionHash, timestamp: Number(record.timestamp), margin: margin, - baseFee: (BigInt(record.baseFee) + BigInt(symbol.protocolFee)).toString(), + protocolFee: BigInt(symbol.protocolFee).toString(), + baseFee: BigInt(record.baseFee).toString(), liquidityFeeRate: Number(record.liquidityFeeRate), slashCount: 0, withdrawNonce: 0,