Skip to content

Commit

Permalink
Merge pull request #191 from aldrin-labs/feature/interest-protocol-in…
Browse files Browse the repository at this point in the history
…tegration

Feature/interest protocol integration
  • Loading branch information
avernikoz authored May 11, 2024
2 parents bbb9be0 + 99fe82e commit b678cdc
Show file tree
Hide file tree
Showing 3 changed files with 267 additions and 28 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"node": "20"
},
"dependencies": {
"@avernikoz/rinbot-sui-sdk": "2.8.2",
"@avernikoz/rinbot-sui-sdk": "2.8.3",
"@aws-sdk/client-dynamodb": "^3.540.0",
"@aws-sdk/lib-dynamodb": "^3.540.0",
"@grammyjs/auto-retry": "^1.1.1",
Expand Down
18 changes: 16 additions & 2 deletions src/chains/sui.functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
CoinAssetData,
CoinManagerSingleton,
FlowxSingleton,
InterestProtocolSingleton,
LONG_SUI_COIN_TYPE,
RedisStorageSingleton,
RouteManager,
Expand Down Expand Up @@ -138,9 +139,22 @@ export const getAftermath = async () => {
return aftermath;
};

export const getInterest = async () => {
const { redisClient } = await getRedisClient();
const storage = RedisStorageSingleton.getInstance(redisClient);

const interest = await InterestProtocolSingleton.getInstance({
suiProviderUrl: SUI_PROVIDER_URL,
cacheOptions: { storage, ...SUI_LIQUIDITY_PROVIDERS_CACHE_OPTIONS },
lazyLoading: false,
});

return interest;
};

export const getCoinManager = async () => {
console.time(`CoinManagerSingleton.getInstance ${randomUuid}`);
const providers = await Promise.all([getAftermath(), getCetus(), getTurbos(), getFlowx()]);
const providers = await Promise.all([getAftermath(), getCetus(), getTurbos(), getFlowx(), getInterest()]);

const coinManager = CoinManagerSingleton.getInstance(providers, SUI_PROVIDER_URL);
console.timeEnd(`CoinManagerSingleton.getInstance ${randomUuid}`);
Expand All @@ -161,7 +175,7 @@ export const getWalletManager = async () => {
export const getRouteManager = async () => {
// console.time(`RouteManager.getInstance.${randomUuid}`)
const coinManager = await getCoinManager();
const providers = await Promise.all([getAftermath(), getCetus(), getTurbos(), getFlowx()]);
const providers = await Promise.all([getAftermath(), getCetus(), getTurbos(), getFlowx(), getInterest()]);

const routerManager = RouteManager.getInstance(providers, coinManager);
// console.timeEnd(`RouteManager.getInstance.${randomUuid}`)
Expand Down
Loading

0 comments on commit b678cdc

Please sign in to comment.