Skip to content

Commit

Permalink
add protocol fee
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoch05 committed Oct 11, 2023
1 parent 8defb77 commit 4c56ac0
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
8 changes: 8 additions & 0 deletions apollo/prisma/migrations/20231011073505_init/migration.sql
Original file line number Diff line number Diff line change
@@ -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;
1 change: 1 addition & 0 deletions apollo/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ model Lnv20RelayInfo {
transaction_hash String
timestamp Int
margin String
protocolFee String
baseFee String
liquidityFeeRate Int
slashCount Int
Expand Down
1 change: 1 addition & 0 deletions apollo/src/aggregation/aggregation.history.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ type Lnv20RelayInfo {
transaction_hash: String!
timestamp: Int!
margin: String
protocolFee: String
baseFee: String
liquidityFeeRate: Int
slashCount: Int
Expand Down
1 change: 1 addition & 0 deletions apollo/src/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export class Lnv20RelayInfo {
transaction_hash: string;
timestamp: number;
margin?: Nullable<string>;
protocolFee?: Nullable<string>;
baseFee?: Nullable<string>;
liquidityFeeRate?: Nullable<number>;
slashCount?: Nullable<number>;
Expand Down
6 changes: 4 additions & 2 deletions apollo/src/lnbridgev20/lnbridgev20.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 4c56ac0

Please sign in to comment.