-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from zkLinkProtocol/feat-transfer-faild-v2
1. filled puffer/magpie/rseth faild transfers; 2. remove layerbank and aqua pool contract; 3. points added aqua;
- Loading branch information
Showing
16 changed files
with
496 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Entity, Column, PrimaryColumn, Index } from "typeorm"; | ||
import { BaseEntity } from "./base.entity"; | ||
import { bigIntNumberTransformer } from "../transformers/bigIntNumber.transformer"; | ||
import { hexTransformer } from "../transformers/hex.transformer"; | ||
|
||
@Entity({ name: "balancesOfLp" }) | ||
@Index(["blockNumber", "balance"]) | ||
export class BalanceOfLp extends BaseEntity { | ||
@PrimaryColumn({ type: "bytea", transformer: hexTransformer }) | ||
public readonly address: string; | ||
|
||
@PrimaryColumn({ type: "bytea", transformer: hexTransformer }) | ||
public readonly tokenAddress: string; | ||
|
||
@PrimaryColumn({ type: "bytea", transformer: hexTransformer }) | ||
public readonly pairAddress: string; | ||
|
||
@PrimaryColumn({ type: "bigint", transformer: bigIntNumberTransformer }) | ||
public readonly blockNumber: number; | ||
|
||
@Column({ type: "varchar", length: 50 }) | ||
public readonly balance: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { Injectable, Logger } from "@nestjs/common"; | ||
import { GraphQueryService } from "src/common/service/graphQuery.service"; | ||
import { NovaService, PointData } from "src/nova/nova.service"; | ||
|
||
@Injectable() | ||
export class AquaService { | ||
private readonly logger: Logger; | ||
private readonly projectName: string = "aqua"; | ||
|
||
public constructor( | ||
private graphQueryService: GraphQueryService, | ||
private novaService: NovaService, | ||
) { | ||
this.logger = new Logger(NovaService.name); | ||
} | ||
|
||
public async getPoints( | ||
tokenAddress: string, | ||
addresses: string[], | ||
): Promise<PointData> { | ||
const finalPoints = []; | ||
const finalTotalPoints = BigInt(0); | ||
const projects = this.graphQueryService.getAllProjectIds(this.projectName); | ||
const project = `${this.projectName}-${tokenAddress}`; | ||
if (!projects.includes(project)) { | ||
this.logger.error(`Notfound GraphQL data, project is : ${project} .`); | ||
return { finalPoints, finalTotalPoints }; | ||
} | ||
|
||
const [points, totalPoints] = | ||
await this.graphQueryService.queryPointsRedistributedByAddress( | ||
addresses, | ||
project, | ||
); | ||
|
||
if (Array.isArray(points) && totalPoints) { | ||
return this.novaService.getPointData(points, totalPoints); | ||
} else { | ||
// Exception in fetching GraphQL data. | ||
throw new Error( | ||
`Exception in fetching GraphQL data, project is : ${project}.`, | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.