From 4fd3661e28be13e209d016afe5a5b213d173db52 Mon Sep 17 00:00:00 2001 From: Shubham Date: Thu, 1 Feb 2024 16:57:29 +0530 Subject: [PATCH] Implemented range bound health factor ,borrow and supply apy notifications --- src/sample_showrunners/aave/mockCache.ts | 88 ---------------------- src/sample_showrunners/aave/sample.test.ts | 34 --------- 2 files changed, 122 deletions(-) delete mode 100644 src/sample_showrunners/aave/mockCache.ts delete mode 100644 src/sample_showrunners/aave/sample.test.ts diff --git a/src/sample_showrunners/aave/mockCache.ts b/src/sample_showrunners/aave/mockCache.ts deleted file mode 100644 index 20827ef..0000000 --- a/src/sample_showrunners/aave/mockCache.ts +++ /dev/null @@ -1,88 +0,0 @@ -const redis = require('async-redis'); - -class CacheInstance { - private ReddisInstance; - constructor() {} - /** - * Set cache - * @description adds a part - * @param {String} key Cache Key - * @param {String} value Cache Value - * @return {Promise<{ null }>} - */ - public async setCache(key: String, value: Number) { - return null; - } - - /** - * push lcache - * @description adds to a cache like an array - * @param {String} key Cache Key - * @param {String} value Cache Value - * @return {Promise<{ null }>} - */ - public async pushLCache(key: String, value: Number) { - return null; - } - - /** - * get lcache - * @description get all items in a list - * @param {String} key Cache Key - * @return {Promise<{ null }>} - */ - public async getLCache(key: String) { - return null; - } - - /** - * Add caches - * @description adds to already existing value in cache - * @param {String} key Cache Key - * @param {Number} value Value to be added - * @return {Promise<{ null }>} - */ - public async addCache(key: String, value: Number) { - const prev: Number = Number(await this.getCache(key)); - if (prev != 0) { - value = Number(prev) + Number(value); - value = Number(value) / 2; - } - return null; - } - - /** - * Remove cache - * @description deletes a cache key and its associated values - * @param {String} key Cache Key - * @return {Promise<{ null }>} - */ - public async removeCache(key: String) { - return null; - } - - /** - * Get cache - * @description retrieves the value of a cache key - * @param {String} key Cache Key - * @return {Promise<{ String }>} - */ - public async getCache(key: String) { - return null; - } - - /** - * Set set Icache - * @description add cache for certain time period - * @param {String} key Cache Key - * @param {Number} expiresIn Time in seconds for expiry - * @param {String} value Cache value - * @return {Promise<{ String }>} - */ - - public async addIcache(key: String, value: String, expiresIn: Number) { - return null; - } -} - -export default new CacheInstance(); \ No newline at end of file diff --git a/src/sample_showrunners/aave/sample.test.ts b/src/sample_showrunners/aave/sample.test.ts deleted file mode 100644 index 5814d56..0000000 --- a/src/sample_showrunners/aave/sample.test.ts +++ /dev/null @@ -1,34 +0,0 @@ -import AaveChannel from "./aaveChannel"; -import fakeCache from './mockCache'; -import Container from 'typedi'; - -// mock logger object -const mockLogger: any = { - info: (...___: any[]) => true, - debug: (...___: any[]) => true, - error: (...value: any[]) => console.log('test', ...value), -}; - -const aave = new AaveChannel(mockLogger as any,fakeCache); -describe('Liquidation Factors', () => { - - beforeAll(() => { - Container.set('cached', fakeCache); - }); - - it('Can check Health factor between 0 to 3', async() => { - let i=0; - while(i<=3){ - expect(await aave.testLogic(i)).toBe(true); - i = i+0.1; - } - }); - - it('It checks Health factor above 3', async() => { - let i=3.1; - while(i<=4){ - expect(await aave.testLogic(i)).toBe(false); - i = i+0.1; - } - }); -});