Sub-Adapters 1
Preview and test each sub adapter.
Apollo (apollo)
Metadata
- ID
- apollo
- name
"Apollo"
- icon
- website
"https://apollo.farm"
- governanceSite
"https://safe.apollo.farm"
- treasuries
[]
Queries
Adapter Code
Check the entire code written for the Adapter.
Source code
Showing TS source.
1export const name = 'Apollo Treasury';
2export const version = '0.0.2';
3export const license = 'MIT';
4
5export function setup(sdk: Context) {
6 const getTreasuryInUSD = async () => {
7 const data = await sdk.http.get('https://api.apollo.farm/api/landing-stats');
8 return parseFloat(data.warchest.replace(/[$,]/g, ''));
9 }
10
11 const getPortfolio = async () => {
12 const data = await sdk.http.get('https://api.apollo.farm/api/landing-stats');
13 return Object.values(data.details).map((item: any) => ({
14 address: '',
15 amount: item.balance / 1e6,
16 value: item.value / 1e6,
17 price: item.swap,
18 name: item.label,
19 symbol: item.label,
20 icon: null,
21 }))
22 }
23
24 sdk.register({
25 id: 'apollo',
26 queries: {
27 currentTreasuryUSD: getTreasuryInUSD,
28 currentLiquidTreasuryUSD: getTreasuryInUSD,
29 currentTreasuryPortfolio: getPortfolio,
30 recentProposals: async () => [],
31 },
32 metadata: {
33 name: 'Apollo',
34 icon: sdk.ipfs.getDataURILoader('QmXMY2G5a1kJvYJkVvWQJmdNuTjHSbwuVPRCcQq7PTKaFq', 'image/svg+xml'),
35 website: 'https://apollo.farm',
36 governanceSite: 'https://safe.apollo.farm',
37 treasuries: [],
38 },
39 })
40}
41
It's something off?
Report it to the discussion board on Discord, we will take care of it.