-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* liquidity manager file structure * rebalancing logic * solve lint warnings * increase liquidity manager processor concurrency * liquidity provider structure * LiFi implementation * fix jest module name mapper * increase check balances cron job interval * fix unit tests * update eco routes package * update beta eco routes version * fix optional prover * only accept patch updates automatically for eco routes * upgrading to eco routes-ts ^0.1.10-beta refactoring code and mongo record for new AUDIT protocol * change warning logs to debug logs * fix table formatting * move bigint conversion (#68) * Batch fulfill (#71) * move bigint conversion * updating repo in package.json (#70) * updating repo in package.json * linter * adding fulfillHyperBatched to fulfillment based on aws configs * linter * changing to run as name * Proof time change (#73) * move bigint conversion * updating times for proofs * remove console * @eco-foundation/routes beta * use job schedulers * move liquidity manager parameters to config * avoid returning undefined * rename LiquidityProviderService * move job interval to config * refactor job manager class * reuse errors * jest test init * Disable storage prover (#74) * move bigint conversion * disabling storage prover from being accepted by solver * update @eco-foundation/routes-ts version * upgrade LiFi SDK version * LiFiProviderService service unit tests * Same chain bug (#78) * move bigint conversion * disabling storage prover from being accepted by solver * add sameChainFulfill check to validate intent * Add check to unsubscribe (#75) * move bigint conversion * disabling storage prover from being accepted by solver * updating routes-ts to ~0.2.10-beta update only on patch * Ed 4570 retry unfeasable (#76) * move bigint conversion * moving watch services into own module. adding watch fulfill intent service * creating watch fulfillment event * refactoring watch create intent to use same abstract parent * adding tests for watch fulfillment adding inbox processor adding intent utils method for update - > needs more work and tests * adding default intervals, intentconfigs, and liquiditymanager to config defaults.ts removing eventemitter from app modules adding interval modeule and service adding interval processor and queue adding retry_intent to source intent queue * adding skeleton of retry infeasable * disabling storage prover from being accepted by solver * updating routes-ts to ~0.2.10-beta update only on patch * fixing merge * adding retry infeasable intents tests * Api (#77) * adding balance api endpoint adding cache manager to project * adding cache configs to configs and defaults * linter * clean up --------- Co-authored-by: Stoyan Dimitrov <s.dimitrov19@gmail.com>
- Loading branch information
1 parent
4391517
commit 907d236
Showing
85 changed files
with
5,056 additions
and
5,502 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { BalanceController } from '@/api/balance.controller' | ||
import { BalanceModule } from '@/balance/balance.module' | ||
import { EcoConfigService } from '@/eco-configs/eco-config.service' | ||
import { CacheInterceptor, CacheModule } from '@nestjs/cache-manager' | ||
import { Module } from '@nestjs/common' | ||
import { APP_INTERCEPTOR } from '@nestjs/core' | ||
|
||
@Module({ | ||
imports: [ | ||
BalanceModule, | ||
CacheModule.registerAsync({ | ||
useFactory: async (configService: EcoConfigService) => configService.getCache(), | ||
inject: [EcoConfigService], | ||
}), | ||
], | ||
controllers: [BalanceController], | ||
providers: [ | ||
{ | ||
provide: APP_INTERCEPTOR, | ||
useClass: CacheInterceptor, | ||
}, | ||
], | ||
}) | ||
export class ApiModule {} |
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,16 @@ | ||
import { BalanceService } from '@/balance/balance.service' | ||
import { API_ROOT, BALANCE_ROUTE } from '@/common/routes/constants' | ||
import { convertBigIntsToStrings } from '@/common/viem/utils' | ||
import { CacheInterceptor } from '@nestjs/cache-manager' | ||
import { Controller, Get, UseInterceptors } from '@nestjs/common' | ||
|
||
@Controller(API_ROOT + BALANCE_ROUTE) | ||
@UseInterceptors(CacheInterceptor) | ||
export class BalanceController { | ||
constructor(private readonly balanceService: BalanceService) {} | ||
|
||
@Get() | ||
async getBalances() { | ||
return convertBigIntsToStrings(await this.balanceService.getAllTokenData()) | ||
} | ||
} |
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,53 @@ | ||
import { Test, TestingModule } from '@nestjs/testing' | ||
import { BalanceController } from '../balance.controller' | ||
import { BalanceService } from '@/balance/balance.service' | ||
import { CACHE_MANAGER } from '@nestjs/cache-manager' | ||
import { createMock } from '@golevelup/ts-jest' | ||
|
||
describe('BalanceController Test', () => { | ||
let balanceController: BalanceController | ||
let balanceService: BalanceService | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
controllers: [BalanceController], | ||
providers: [ | ||
{ | ||
provide: BalanceService, | ||
useValue: createMock<BalanceService>(), | ||
}, | ||
{ | ||
provide: CACHE_MANAGER, | ||
useValue: { | ||
get: jest.fn(), | ||
set: jest.fn(), | ||
}, | ||
}, | ||
], | ||
}).compile() | ||
|
||
balanceController = module.get<BalanceController>(BalanceController) | ||
balanceService = module.get<BalanceService>(BalanceService) | ||
}) | ||
|
||
it('should be defined', () => { | ||
expect(balanceController).toBeDefined() | ||
}) | ||
|
||
describe('getBalances', () => { | ||
it('should return an array of balances', async () => { | ||
const result = [] | ||
jest.spyOn(balanceService, 'getAllTokenData').mockResolvedValue(result) | ||
|
||
expect(await balanceController.getBalances()).toEqual(result) | ||
}) | ||
|
||
it('should call balanceService.getAllTokenData', async () => { | ||
const getAllTokenDataSpy = jest.spyOn(balanceService, 'getAllTokenData').mockResolvedValue([]) | ||
|
||
await balanceController.getBalances() | ||
|
||
expect(getAllTokenDataSpy).toHaveBeenCalled() | ||
}) | ||
}) | ||
}) |
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.