-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
115 additions
and
19 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
30 changes: 30 additions & 0 deletions
30
packages/plugins/src/plugins/pluto/leverageVaultsApiJob.ts
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,30 @@ | ||
import { NetworkId } from '@sonarwatch/portfolio-core'; | ||
import axios from 'axios'; | ||
import { Cache } from '../../Cache'; | ||
import { Job, JobExecutor } from '../../Job'; | ||
import { | ||
leveragesVaultApiKey, | ||
leverageVaultsApiUrl, | ||
platformId, | ||
} from './constants'; | ||
import { LeverageVaultAddress } from './types'; | ||
|
||
const executor: JobExecutor = async (cache: Cache) => { | ||
const vaults = await axios | ||
.get<{ production: { [key: string]: LeverageVaultAddress }[] }>( | ||
leverageVaultsApiUrl | ||
) | ||
.then((response) => response.data); | ||
|
||
await cache.setItem(leveragesVaultApiKey, Object.values(vaults.production), { | ||
prefix: platformId, | ||
networkId: NetworkId.solana, | ||
}); | ||
}; | ||
|
||
const job: Job = { | ||
id: `${platformId}-leverage-vaults-api`, | ||
executor, | ||
label: 'normal', | ||
}; | ||
export default job; |
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,32 @@ | ||
export type LeverageVaultAddress = { | ||
earnName: string; | ||
leverageName: string; | ||
programId: string; | ||
protocol: string; | ||
indexer: string; | ||
keeper: string; | ||
feeVault: string; | ||
tokenProgramA: string; | ||
tokenMintA: string; | ||
tokenDecimalA: number; | ||
tokenCollateralPriceOracle: string; | ||
tokenCollateralPriceFeed: string; | ||
tokenProgramB: string; | ||
tokenMintB: string; | ||
tokenDecimalB: number; | ||
nativeCollateralPriceOracle: string; | ||
nativeCollateralPriceFeed: string; | ||
earnConfig: string; | ||
earnStats: string; | ||
earnVaultAuthority: string; | ||
earnVault: string; | ||
earnVaultLiquidity: string; | ||
leverageConfig: string; | ||
leverageStats: string; | ||
leverageVaultAuthority: string; | ||
leverageVault: string; | ||
leverageVaultTokenCollateralLiquidity: string; | ||
leverageVaultNativeCollateralLiquidity: string; | ||
lookupTable: string; | ||
lookupTableGeneric: string; | ||
}; |