@sonarwatch/portfolio-plugins 0.11.229 → 0.11.231

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. package/CHANGELOG.md +1670 -1662
  2. package/README.md +3 -3
  3. package/package.json +5 -5
  4. package/src/index.js +8 -4
  5. package/src/index.js.map +1 -1
  6. package/src/plugins/balancer/helpers/pools.js +21 -21
  7. package/src/plugins/elixir/constants.d.ts +12 -0
  8. package/src/plugins/elixir/constants.js +79 -0
  9. package/src/plugins/elixir/constants.js.map +1 -0
  10. package/src/plugins/elixir/helpers.d.ts +2 -0
  11. package/src/plugins/elixir/helpers.js +40 -0
  12. package/src/plugins/elixir/helpers.js.map +1 -0
  13. package/src/plugins/{metadao → elixir}/index.js +3 -3
  14. package/src/plugins/elixir/index.js.map +1 -0
  15. package/src/plugins/elixir/positionsFetcher.d.ts +3 -0
  16. package/src/plugins/elixir/positionsFetcher.js +153 -0
  17. package/src/plugins/elixir/positionsFetcher.js.map +1 -0
  18. package/src/plugins/elixir/types.d.ts +43 -0
  19. package/src/plugins/elixir/types.js +3 -0
  20. package/src/plugins/elixir/types.js.map +1 -0
  21. package/src/plugins/elixir/vaultsJob.js +48 -0
  22. package/src/plugins/elixir/vaultsJob.js.map +1 -0
  23. package/src/plugins/{metadao → futarchy}/constants.d.ts +3 -3
  24. package/src/plugins/futarchy/constants.js +19 -0
  25. package/src/plugins/futarchy/constants.js.map +1 -0
  26. package/src/plugins/futarchy/daosJob.js +283 -0
  27. package/src/plugins/futarchy/daosJob.js.map +1 -0
  28. package/src/plugins/futarchy/index.d.ts +6 -0
  29. package/src/plugins/futarchy/index.js +12 -0
  30. package/src/plugins/futarchy/index.js.map +1 -0
  31. package/src/plugins/futarchy/structs.d.ts +96 -0
  32. package/src/plugins/futarchy/structs.js +94 -0
  33. package/src/plugins/futarchy/structs.js.map +1 -0
  34. package/src/plugins/sushiswap/helpers.js +24 -24
  35. package/src/plugins/texture/index.js +5 -0
  36. package/src/plugins/texture/index.js.map +1 -1
  37. package/src/plugins/uniswap-v2/helpers.js +22 -22
  38. package/src/utils/aptos/getAccountResources.d.ts +1 -1
  39. package/src/utils/aptos/getCoinStoreResources.d.ts +1 -1
  40. package/src/utils/aptos/getView.d.ts +1 -1
  41. package/src/utils/clients/getClientCosmos.d.ts +84 -57
  42. package/src/utils/clients/getClientIbc.d.ts +144 -103
  43. package/src/utils/clients/getClientSei.d.ts +97 -97
  44. package/src/utils/misc/getLpUnderlyingTokenSource.d.ts +2 -0
  45. package/src/utils/misc/getLpUnderlyingTokenSource.js +3 -1
  46. package/src/utils/misc/getLpUnderlyingTokenSource.js.map +1 -1
  47. package/src/utils/sei/constants.js +8 -8
  48. package/src/utils/sei/getAllBalances.d.ts +2 -2
  49. package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
  50. package/src/plugins/metadao/constants.js +0 -16
  51. package/src/plugins/metadao/constants.js.map +0 -1
  52. package/src/plugins/metadao/index.js.map +0 -1
  53. package/src/plugins/metadao/poolsJob.js +0 -98
  54. package/src/plugins/metadao/poolsJob.js.map +0 -1
  55. package/src/plugins/metadao/structs.d.ts +0 -44
  56. package/src/plugins/metadao/structs.js +0 -45
  57. package/src/plugins/metadao/structs.js.map +0 -1
  58. package/src/plugins/metadao/vaultsJob.js +0 -113
  59. package/src/plugins/metadao/vaultsJob.js.map +0 -1
  60. /package/src/plugins/{metadao → elixir}/index.d.ts +0 -0
  61. /package/src/plugins/{metadao → elixir}/vaultsJob.d.ts +0 -0
  62. /package/src/plugins/{metadao/poolsJob.d.ts → futarchy/daosJob.d.ts} +0 -0
@@ -0,0 +1,283 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
13
+ const clients_1 = require("../../utils/clients");
14
+ const solana_1 = require("../../utils/solana");
15
+ const filters_1 = require("../../utils/solana/filters");
16
+ const constants_1 = require("./constants");
17
+ const structs_1 = require("./structs");
18
+ const helpers_1 = require("../scallop/helpers");
19
+ const getLpTokenSource_1 = require("../../utils/misc/getLpTokenSource");
20
+ const constants_2 = require("../tokens/constants");
21
+ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
22
+ var _a, _b, _c;
23
+ const client = (0, clients_1.getClientSolana)();
24
+ const daos = yield (0, solana_1.getParsedProgramAccounts)(client, structs_1.daoStruct, constants_1.daoPid, (0, filters_1.dataSizeFilter)(168));
25
+ const daoById = new Map();
26
+ daos.forEach((dao) => daoById.set(dao.pubkey.toString(), dao));
27
+ const proposals = yield (0, solana_1.getParsedProgramAccounts)(client, structs_1.proposalStruct, constants_1.daoPid, (0, filters_1.dataSizeFilter)(2000));
28
+ const amms = [];
29
+ const vaults = [];
30
+ proposals.forEach((prop) => {
31
+ amms.push(prop.failAmm, prop.passAmm);
32
+ vaults.push(prop.baseVault, prop.quoteVault);
33
+ });
34
+ const [ammsAccounts, vaultsAccounts] = yield Promise.all([
35
+ (0, solana_1.getParsedMultipleAccountsInfo)(client, structs_1.ammStruct, amms),
36
+ (0, solana_1.getParsedMultipleAccountsInfo)(client, structs_1.conditionnalVaultStruct, vaults),
37
+ ]);
38
+ const ammById = new Map();
39
+ const vaultById = new Map();
40
+ const tokensPubkeys = [];
41
+ const mintsPubkeys = [];
42
+ const underlyingMints = new Set();
43
+ ammsAccounts.forEach((acc) => {
44
+ if (acc) {
45
+ ammById.set(acc.pubkey.toString(), acc);
46
+ mintsPubkeys.push(acc.lpMint);
47
+ }
48
+ });
49
+ vaultsAccounts.forEach((acc) => {
50
+ if (acc) {
51
+ vaultById.set(acc.pubkey.toString(), acc);
52
+ tokensPubkeys.push(acc.underlyingTokenAccount);
53
+ mintsPubkeys.push(acc.conditionalOnFinalizeTokenMint, acc.conditionalOnRevertTokenMint);
54
+ underlyingMints.add(acc.underlyingTokenMint.toString());
55
+ }
56
+ });
57
+ const [tokensAccounts, mintsAccounts, underlyingTokenPriceById, tokenList] = yield Promise.all([
58
+ (0, solana_1.getParsedMultipleAccountsInfo)(client, solana_1.tokenAccountStruct, tokensPubkeys),
59
+ (0, solana_1.getParsedMultipleAccountsInfo)(client, solana_1.mintAccountStruct, mintsPubkeys),
60
+ yield cache.getTokenPricesAsMap(Array.from(underlyingMints), portfolio_core_1.NetworkId.solana),
61
+ cache.getItems(Array.from(underlyingMints), {
62
+ prefix: constants_2.tokenListsDetailsPrefix,
63
+ networkId: portfolio_core_1.NetworkId.solana,
64
+ }),
65
+ ]);
66
+ const tokenAccountById = new Map();
67
+ const mintAccountById = new Map();
68
+ const tokensDetailsById = new Map();
69
+ tokensAccounts.forEach((acc) => {
70
+ if (acc)
71
+ tokenAccountById.set(acc.pubkey.toString(), acc);
72
+ });
73
+ mintsAccounts.forEach((acc) => {
74
+ if (acc)
75
+ mintAccountById.set(acc.pubkey.toString(), acc);
76
+ });
77
+ tokenList.forEach((tD) => tD ? tokensDetailsById.set(tD.address, tD) : undefined);
78
+ const tokenPriceSources = [];
79
+ const usdSourceById = new Map();
80
+ for (const proposal of proposals) {
81
+ const [passAmm, failAmm] = [
82
+ ammById.get(proposal.passAmm.toString()),
83
+ ammById.get(proposal.failAmm.toString()),
84
+ ];
85
+ const [quoteVault, baseVault] = [
86
+ vaultById.get(proposal.quoteVault.toString()),
87
+ vaultById.get(proposal.baseVault.toString()),
88
+ ];
89
+ const dao = daoById.get(proposal.dao.toString());
90
+ if (!passAmm || !failAmm || !quoteVault || !baseVault || !dao)
91
+ continue;
92
+ const daoName = constants_1.daoNameById.get(dao.pubkey.toString());
93
+ const elementName = `${daoName} Proposal : ${(0, helpers_1.shortenAddress)(proposal.pubkey.toString())} (${structs_1.ProposalState[proposal.state]})`;
94
+ const usdReserveAccount = tokenAccountById.get(quoteVault.underlyingTokenAccount.toString());
95
+ const [usdTokenPrice, baseUnderlyingTokenPrice, baseUnderlyingTokenDetail] = [
96
+ underlyingTokenPriceById.get(quoteVault.underlyingTokenMint.toString()),
97
+ underlyingTokenPriceById.get(baseVault.underlyingTokenMint.toString()),
98
+ tokensDetailsById.get(baseVault.underlyingTokenMint.toString()),
99
+ ];
100
+ // Price the pUSD and fUSD of this proposal
101
+ if (usdReserveAccount &&
102
+ !usdReserveAccount.amount.isZero() &&
103
+ usdTokenPrice) {
104
+ const pUSDMint = quoteVault.conditionalOnFinalizeTokenMint.toString();
105
+ const fUSDMint = quoteVault.conditionalOnRevertTokenMint.toString();
106
+ const underlyingValue = usdReserveAccount.amount
107
+ .times(usdTokenPrice.price)
108
+ .dividedBy(Math.pow(10, quoteVault.decimals));
109
+ const [pUSDMintAccount, fUSDMintAccount] = [
110
+ mintAccountById.get(pUSDMint),
111
+ mintAccountById.get(fUSDMint),
112
+ ];
113
+ if (!pUSDMintAccount || !fUSDMintAccount)
114
+ continue;
115
+ const pUSDPrice = underlyingValue
116
+ .dividedBy(pUSDMintAccount.supply.dividedBy(Math.pow(10, pUSDMintAccount.decimals)))
117
+ .dividedBy(2);
118
+ const fUSDPrice = underlyingValue
119
+ .dividedBy(fUSDMintAccount.supply.dividedBy(Math.pow(10, fUSDMintAccount.decimals)))
120
+ .dividedBy(2);
121
+ const fUSDSource = {
122
+ address: fUSDMint,
123
+ decimals: fUSDMintAccount.decimals,
124
+ id: proposal.quoteVault.toString(),
125
+ networkId: portfolio_core_1.NetworkId.solana,
126
+ platformId: constants_1.platformId,
127
+ price: fUSDPrice.toNumber(),
128
+ timestamp: Date.now(),
129
+ weight: 1,
130
+ underlyings: [
131
+ {
132
+ amountPerLp: 1,
133
+ price: fUSDPrice.toNumber(),
134
+ address: usdTokenPrice.address,
135
+ decimals: usdTokenPrice.decimals,
136
+ networkId: portfolio_core_1.NetworkId.solana,
137
+ },
138
+ ],
139
+ liquidityName: `fUSD`,
140
+ elementName,
141
+ };
142
+ const pUSDSource = {
143
+ address: pUSDMint,
144
+ decimals: pUSDMintAccount.decimals,
145
+ id: proposal.quoteVault.toString(),
146
+ networkId: portfolio_core_1.NetworkId.solana,
147
+ platformId: constants_1.platformId,
148
+ price: pUSDPrice.toNumber(),
149
+ timestamp: Date.now(),
150
+ weight: 1,
151
+ underlyings: [
152
+ {
153
+ amountPerLp: 1,
154
+ price: pUSDPrice.toNumber(),
155
+ address: usdTokenPrice.address,
156
+ decimals: usdTokenPrice.decimals,
157
+ networkId: portfolio_core_1.NetworkId.solana,
158
+ },
159
+ ],
160
+ liquidityName: `pUSD`,
161
+ elementName,
162
+ };
163
+ // If the Proposal has passed, fUSD will not be redeemable (price = 0)
164
+ if (proposal.state === structs_1.ProposalState.Passed) {
165
+ fUSDSource.price = 0;
166
+ if ((_a = fUSDSource.underlyings) === null || _a === void 0 ? void 0 : _a.at(0))
167
+ fUSDSource.underlyings[0].price = 0;
168
+ }
169
+ // If the Proposal has failed, pUSD will not be redeemable (price = 0)
170
+ if (proposal.state === structs_1.ProposalState.Failed) {
171
+ pUSDSource.price = 0;
172
+ if ((_b = pUSDSource.underlyings) === null || _b === void 0 ? void 0 : _b.at(0))
173
+ pUSDSource.underlyings[0].price = 0;
174
+ }
175
+ tokenPriceSources.push(pUSDSource, fUSDSource);
176
+ usdSourceById.set(pUSDSource.address, pUSDSource);
177
+ usdSourceById.set(fUSDSource.address, fUSDSource);
178
+ }
179
+ // Price the pToken and fToken of this proposal from the pools composition
180
+ for (const amm of [passAmm, failAmm]) {
181
+ if (amm.baseAmount.isZero())
182
+ continue;
183
+ const [lpMint, baseMint, quoteMint] = [
184
+ amm.lpMint.toString(),
185
+ amm.baseMint.toString(),
186
+ amm.quoteMint.toString(),
187
+ ];
188
+ const [quoteSource, lpMintAccount] = [
189
+ usdSourceById.get(amm.quoteMint.toString()),
190
+ mintAccountById.get(lpMint),
191
+ ];
192
+ if (!quoteSource ||
193
+ !lpMintAccount ||
194
+ !baseUnderlyingTokenPrice ||
195
+ !baseUnderlyingTokenDetail)
196
+ continue;
197
+ const isPassAmm = amm.pubkey.toString() === proposal.passAmm.toString();
198
+ const liquidityName = isPassAmm ? 'Pass LP' : 'Fail LP';
199
+ const baseLiquidityName = isPassAmm
200
+ ? `p${baseUnderlyingTokenDetail.symbol}`
201
+ : `f${baseUnderlyingTokenDetail.symbol}`;
202
+ const basePrice = amm.quoteAmount
203
+ .dividedBy(Math.pow(10, amm.quoteMintDecimals))
204
+ .dividedBy(amm.baseAmount.dividedBy(Math.pow(10, amm.baseMintDecimals)))
205
+ .toNumber();
206
+ const baseTokenPriceSource = {
207
+ address: baseMint,
208
+ decimals: amm.baseMintDecimals,
209
+ weight: 1,
210
+ price: basePrice,
211
+ id: constants_1.platformId,
212
+ networkId: portfolio_core_1.NetworkId.solana,
213
+ platformId: constants_1.platformId,
214
+ timestamp: Date.now(),
215
+ underlyings: [Object.assign(Object.assign({}, baseUnderlyingTokenPrice), { amountPerLp: 1 })],
216
+ liquidityName: baseLiquidityName,
217
+ elementName,
218
+ };
219
+ // If it's the amm handling the Pass LP and the Proposal has failed, pToken will not be redeemable (price = 0)
220
+ // If it's the amm handling the Fail LP and the Proposal has passed, fToken will not be redeemable (price = 0)
221
+ if ((proposal.state === structs_1.ProposalState.Failed && isPassAmm) ||
222
+ (proposal.state === structs_1.ProposalState.Passed && !isPassAmm)) {
223
+ baseTokenPriceSource.price = 0;
224
+ if ((_c = baseTokenPriceSource.underlyings) === null || _c === void 0 ? void 0 : _c.at(0))
225
+ baseTokenPriceSource.underlyings[0].price = 0;
226
+ }
227
+ const baseTokenPrice = (0, portfolio_core_1.tokenPriceFromSources)([baseTokenPriceSource]);
228
+ const quotePrice = (0, portfolio_core_1.tokenPriceFromSources)([quoteSource]);
229
+ if (!baseTokenPrice)
230
+ continue;
231
+ const lpSource = (0, getLpTokenSource_1.getLpTokenSource)({
232
+ lpDetails: {
233
+ address: lpMint,
234
+ decimals: lpMintAccount.decimals,
235
+ supply: lpMintAccount.supply
236
+ .dividedBy(Math.pow(10, lpMintAccount.decimals))
237
+ .toNumber(),
238
+ },
239
+ networkId: portfolio_core_1.NetworkId.solana,
240
+ platformId: constants_1.platformId,
241
+ poolUnderlyings: [
242
+ {
243
+ address: baseMint,
244
+ decimals: amm.baseMintDecimals,
245
+ reserveAmount: amm.baseAmount
246
+ .dividedBy(Math.pow(10, amm.baseMintDecimals))
247
+ .toNumber(),
248
+ weight: 0.5,
249
+ tokenPrice: baseTokenPrice,
250
+ },
251
+ {
252
+ address: quoteMint,
253
+ decimals: amm.quoteMintDecimals,
254
+ reserveAmount: amm.quoteAmount
255
+ .dividedBy(Math.pow(10, amm.quoteMintDecimals))
256
+ .toNumber(),
257
+ weight: 0.5,
258
+ tokenPrice: quotePrice,
259
+ },
260
+ ],
261
+ sourceId: constants_1.platformId,
262
+ liquidityName,
263
+ elementName,
264
+ });
265
+ if (lpSource.at(0)) {
266
+ // If it's the amm handling the Pass LP and the Proposal has failed, Pass LP will not be redeemable (price = 0)
267
+ // If it's the amm handling the Fail LP and the Proposal has passed, Fail LP will not be redeemable (price = 0)
268
+ if ((proposal.state === structs_1.ProposalState.Failed && isPassAmm) ||
269
+ (proposal.state === structs_1.ProposalState.Passed && !isPassAmm))
270
+ lpSource[0].price = 0;
271
+ }
272
+ tokenPriceSources.push(...lpSource, baseTokenPriceSource);
273
+ }
274
+ }
275
+ yield cache.setTokenPriceSources(tokenPriceSources);
276
+ });
277
+ const job = {
278
+ id: `${constants_1.platformId}-daos`,
279
+ executor,
280
+ label: 'normal',
281
+ };
282
+ exports.default = job;
283
+ //# sourceMappingURL=daosJob.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daosJob.js","sourceRoot":"","sources":["../../../../../../packages/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AC,EAAE,CAAC;gBACnB,+GAA+G;gBAC/G,+GAA+G;gBAC/G,IACE,CAAC,QAAQ,CAAC,KAAK,KAAK,uBAAa,CAAC,MAAM,IAAI,SAAS,CAAC;oBACtD,CAAC,QAAQ,CAAC,KAAK,KAAK,uBAAa,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC;oBAEvD,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC;YAC1B,CAAC;YACD,iBAAiB,CAAC,IAAI,CAAC,GAAG,QAAQ,EAAE,oBAAoB,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC;IACD,MAAM,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AACtD,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,OAAO;IACxB,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Platform } from '@sonarwatch/portfolio-core';
2
+ import { Fetcher } from '../../Fetcher';
3
+ import { Job } from '../../Job';
4
+ export declare const platforms: Platform[];
5
+ export declare const jobs: Job[];
6
+ export declare const fetchers: Fetcher[];
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.fetchers = exports.jobs = exports.platforms = void 0;
7
+ const constants_1 = require("./constants");
8
+ const daosJob_1 = __importDefault(require("./daosJob"));
9
+ exports.platforms = [constants_1.platform];
10
+ exports.jobs = [daosJob_1.default];
11
+ exports.fetchers = [];
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/futarchy/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,wDAAgC;AAEnB,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,iBAAO,CAAC,CAAC;AACxB,QAAA,QAAQ,GAAc,EAAE,CAAC"}
@@ -0,0 +1,96 @@
1
+ /// <reference types="node" />
2
+ import { BeetStruct, FixableBeetStruct } from '@metaplex-foundation/beet';
3
+ import { PublicKey } from '@metaplex-foundation/js';
4
+ import BigNumber from 'bignumber.js';
5
+ export declare enum VaultStatus {
6
+ Active = 0,
7
+ Finalized = 1,
8
+ Reverted = 2
9
+ }
10
+ export type ConditionnalVault = {
11
+ buffer: Buffer;
12
+ status: VaultStatus;
13
+ settlementAuthority: PublicKey;
14
+ underlyingTokenMint: PublicKey;
15
+ underlyingTokenAccount: PublicKey;
16
+ conditionalOnFinalizeTokenMint: PublicKey;
17
+ conditionalOnRevertTokenMint: PublicKey;
18
+ pdaBump: number;
19
+ decimals: number;
20
+ };
21
+ export declare const conditionnalVaultStruct: BeetStruct<ConditionnalVault, Partial<ConditionnalVault>>;
22
+ export type TwapOracle = {
23
+ lastUpdatedSlot: BigNumber;
24
+ lastPrice: BigNumber;
25
+ lastObservation: BigNumber;
26
+ aggregator: BigNumber;
27
+ maxObservationChangePerUpdate: BigNumber;
28
+ initialObservation: BigNumber;
29
+ };
30
+ export declare const twapOracleStruct: BeetStruct<TwapOracle, Partial<TwapOracle>>;
31
+ export type Amm = {
32
+ buffer: Buffer;
33
+ bump: number;
34
+ createdAtSlot: BigNumber;
35
+ lpMint: PublicKey;
36
+ baseMint: PublicKey;
37
+ quoteMint: PublicKey;
38
+ baseMintDecimals: number;
39
+ quoteMintDecimals: number;
40
+ baseAmount: BigNumber;
41
+ quoteAmount: BigNumber;
42
+ oracle: TwapOracle;
43
+ };
44
+ export declare const ammStruct: BeetStruct<Amm, Partial<Amm>>;
45
+ export type Dao = {
46
+ buffer: Buffer;
47
+ treasuryPdaBump: number;
48
+ treasury: PublicKey;
49
+ tokenMint: PublicKey;
50
+ usdcMint: PublicKey;
51
+ proposalCount: number;
52
+ passThresholdBps: number;
53
+ slotsPerProposal: BigNumber;
54
+ twapInitialObservation: BigNumber;
55
+ twapMaxObservationChangePerUpdate: BigNumber;
56
+ minQuoteFutarchicLiquidity: BigNumber;
57
+ minBaseFutarchicLiquidity: BigNumber;
58
+ };
59
+ export declare const daoStruct: BeetStruct<Dao, Partial<Dao>>;
60
+ export declare enum ProposalState {
61
+ Pending = 0,
62
+ Passed = 1,
63
+ Failed = 2,
64
+ Executed = 3
65
+ }
66
+ export type ProposalAccount = {
67
+ pubkey: PublicKey;
68
+ isSigner: boolean;
69
+ isWritable: boolean;
70
+ };
71
+ export declare const proposalAccountStruct: BeetStruct<ProposalAccount, Partial<ProposalAccount>>;
72
+ export type ProposalInstruction = {
73
+ programId: PublicKey;
74
+ accounts: ProposalAccount[];
75
+ data: number[];
76
+ };
77
+ export declare const proposalInstructionStruct: FixableBeetStruct<ProposalInstruction, Partial<ProposalInstruction>>;
78
+ export type Proposal = {
79
+ buffer: Buffer;
80
+ number: number;
81
+ proposer: PublicKey;
82
+ descriptionUrl: number[];
83
+ slotEnqueued: BigNumber;
84
+ state: ProposalState;
85
+ instruction: ProposalInstruction;
86
+ passAmm: PublicKey;
87
+ failAmm: PublicKey;
88
+ baseVault: PublicKey;
89
+ quoteVault: PublicKey;
90
+ dao: PublicKey;
91
+ passLpTokensLocked: BigNumber;
92
+ failLpTokensLocked: BigNumber;
93
+ nonce: BigNumber;
94
+ pdaBump: number;
95
+ };
96
+ export declare const proposalStruct: FixableBeetStruct<Proposal, Partial<Proposal>>;
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.proposalStruct = exports.proposalInstructionStruct = exports.proposalAccountStruct = exports.ProposalState = exports.daoStruct = exports.ammStruct = exports.twapOracleStruct = exports.conditionnalVaultStruct = exports.VaultStatus = void 0;
4
+ const beet_1 = require("@metaplex-foundation/beet");
5
+ const beet_solana_1 = require("@metaplex-foundation/beet-solana");
6
+ const solana_1 = require("../../utils/solana");
7
+ var VaultStatus;
8
+ (function (VaultStatus) {
9
+ VaultStatus[VaultStatus["Active"] = 0] = "Active";
10
+ VaultStatus[VaultStatus["Finalized"] = 1] = "Finalized";
11
+ VaultStatus[VaultStatus["Reverted"] = 2] = "Reverted";
12
+ })(VaultStatus || (exports.VaultStatus = VaultStatus = {}));
13
+ exports.conditionnalVaultStruct = new beet_1.BeetStruct([
14
+ ['buffer', (0, solana_1.blob)(8)],
15
+ ['status', beet_1.u8],
16
+ ['settlementAuthority', beet_solana_1.publicKey],
17
+ ['underlyingTokenMint', beet_solana_1.publicKey],
18
+ ['underlyingTokenAccount', beet_solana_1.publicKey],
19
+ ['conditionalOnFinalizeTokenMint', beet_solana_1.publicKey],
20
+ ['conditionalOnRevertTokenMint', beet_solana_1.publicKey],
21
+ ['pdaBump', beet_1.u8],
22
+ ['decimals', beet_1.u8],
23
+ ], (args) => args);
24
+ exports.twapOracleStruct = new beet_1.BeetStruct([
25
+ ['lastUpdatedSlot', solana_1.u64],
26
+ ['lastPrice', solana_1.u128],
27
+ ['lastObservation', solana_1.u128],
28
+ ['aggregator', solana_1.u128],
29
+ ['maxObservationChangePerUpdate', solana_1.u128],
30
+ ['initialObservation', solana_1.u128],
31
+ ], (args) => args);
32
+ exports.ammStruct = new beet_1.BeetStruct([
33
+ ['buffer', (0, solana_1.blob)(8)],
34
+ ['bump', beet_1.u8],
35
+ ['createdAtSlot', solana_1.u64],
36
+ ['lpMint', beet_solana_1.publicKey],
37
+ ['baseMint', beet_solana_1.publicKey],
38
+ ['quoteMint', beet_solana_1.publicKey],
39
+ ['baseMintDecimals', beet_1.u8],
40
+ ['quoteMintDecimals', beet_1.u8],
41
+ ['baseAmount', solana_1.u64],
42
+ ['quoteAmount', solana_1.u64],
43
+ ['oracle', exports.twapOracleStruct],
44
+ ], (args) => args);
45
+ exports.daoStruct = new beet_1.BeetStruct([
46
+ ['buffer', (0, solana_1.blob)(8)],
47
+ ['treasuryPdaBump', beet_1.u8],
48
+ ['treasury', beet_solana_1.publicKey],
49
+ ['tokenMint', beet_solana_1.publicKey],
50
+ ['usdcMint', beet_solana_1.publicKey],
51
+ ['proposalCount', beet_1.u32],
52
+ ['passThresholdBps', beet_1.u16],
53
+ ['slotsPerProposal', solana_1.u64],
54
+ ['twapInitialObservation', solana_1.u128],
55
+ ['twapMaxObservationChangePerUpdate', solana_1.u128],
56
+ ['minQuoteFutarchicLiquidity', solana_1.u64],
57
+ ['minBaseFutarchicLiquidity', solana_1.u64],
58
+ ], (args) => args);
59
+ var ProposalState;
60
+ (function (ProposalState) {
61
+ ProposalState[ProposalState["Pending"] = 0] = "Pending";
62
+ ProposalState[ProposalState["Passed"] = 1] = "Passed";
63
+ ProposalState[ProposalState["Failed"] = 2] = "Failed";
64
+ ProposalState[ProposalState["Executed"] = 3] = "Executed";
65
+ })(ProposalState || (exports.ProposalState = ProposalState = {}));
66
+ exports.proposalAccountStruct = new beet_1.BeetStruct([
67
+ ['pubkey', beet_solana_1.publicKey],
68
+ ['isSigner', beet_1.bool],
69
+ ['isWritable', beet_1.bool],
70
+ ], (args) => args);
71
+ exports.proposalInstructionStruct = new beet_1.FixableBeetStruct([
72
+ ['programId', beet_solana_1.publicKey],
73
+ ['accounts', (0, beet_1.array)(exports.proposalAccountStruct)],
74
+ ['data', (0, beet_1.array)(beet_1.u8)],
75
+ ], (args) => args);
76
+ exports.proposalStruct = new beet_1.FixableBeetStruct([
77
+ ['buffer', (0, solana_1.blob)(8)],
78
+ ['number', beet_1.u32],
79
+ ['proposer', beet_solana_1.publicKey],
80
+ ['descriptionUrl', (0, beet_1.array)(beet_1.u8)],
81
+ ['slotEnqueued', solana_1.u64],
82
+ ['state', beet_1.u8],
83
+ ['instruction', exports.proposalInstructionStruct],
84
+ ['passAmm', beet_solana_1.publicKey],
85
+ ['failAmm', beet_solana_1.publicKey],
86
+ ['baseVault', beet_solana_1.publicKey],
87
+ ['quoteVault', beet_solana_1.publicKey],
88
+ ['dao', beet_solana_1.publicKey],
89
+ ['passLpTokensLocked', solana_1.u64],
90
+ ['failLpTokensLocked', solana_1.u64],
91
+ ['nonce', solana_1.u64],
92
+ ['pdaBump', beet_1.u8],
93
+ ], (args) => args);
94
+ //# sourceMappingURL=structs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/futarchy/structs.ts"],"names":[],"mappings":";;;AAAA,oDAQmC;AAEnC,kEAA6D;AAE7D,+CAAqD;AAErD,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,iDAAM,CAAA;IACN,uDAAS,CAAA;IACT,qDAAQ,CAAA;AACV,CAAC,EAJW,WAAW,2BAAX,WAAW,QAItB;AAcY,QAAA,uBAAuB,GAAG,IAAI,iBAAU,CACnD;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,QAAQ,EAAE,SAAE,CAAC;IACd,CAAC,qBAAqB,EAAE,uBAAS,CAAC;IAClC,CAAC,qBAAqB,EAAE,uBAAS,CAAC;IAClC,CAAC,wBAAwB,EAAE,uBAAS,CAAC;IACrC,CAAC,gCAAgC,EAAE,uBAAS,CAAC;IAC7C,CAAC,8BAA8B,EAAE,uBAAS,CAAC;IAC3C,CAAC,SAAS,EAAE,SAAE,CAAC;IACf,CAAC,UAAU,EAAE,SAAE,CAAC;CACjB,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAyB,CACpC,CAAC;AAWW,QAAA,gBAAgB,GAAG,IAAI,iBAAU,CAC5C;IACE,CAAC,iBAAiB,EAAE,YAAG,CAAC;IACxB,CAAC,WAAW,EAAE,aAAI,CAAC;IACnB,CAAC,iBAAiB,EAAE,aAAI,CAAC;IACzB,CAAC,YAAY,EAAE,aAAI,CAAC;IACpB,CAAC,+BAA+B,EAAE,aAAI,CAAC;IACvC,CAAC,oBAAoB,EAAE,a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O,EAAE,YAAG,CAAC;IACd,CAAC,SAAS,EAAE,SAAE,CAAC;CAChB,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAgB,CAC3B,CAAC"}
@@ -54,30 +54,30 @@ function sushiV3PairToUniV2(pair) {
54
54
  }
55
55
  function getV3PairsAddresses(url, length = 300) {
56
56
  return __awaiter(this, void 0, void 0, function* () {
57
- const query = (0, graphql_request_1.gql) `
58
- {
59
- pools(
60
- orderBy: totalValueLockedUSD
61
- first: ${length}
62
- orderDirection: desc
63
- where: { volumeUSD_not: "0", liquidity_not: "0" }
64
- ) {
65
- id
66
- token0Price
67
- token1Price
68
- liquidity
69
- token0 {
70
- id
71
- totalSupply
72
- decimals
73
- }
74
- token1 {
75
- id
76
- totalSupply
77
- decimals
78
- }
79
- }
80
- }
57
+ const query = (0, graphql_request_1.gql) `
58
+ {
59
+ pools(
60
+ orderBy: totalValueLockedUSD
61
+ first: ${length}
62
+ orderDirection: desc
63
+ where: { volumeUSD_not: "0", liquidity_not: "0" }
64
+ ) {
65
+ id
66
+ token0Price
67
+ token1Price
68
+ liquidity
69
+ token0 {
70
+ id
71
+ totalSupply
72
+ decimals
73
+ }
74
+ token1 {
75
+ id
76
+ totalSupply
77
+ decimals
78
+ }
79
+ }
80
+ }
81
81
  `;
82
82
  const res = yield (0, graphql_request_1.default)(url, query);
83
83
  const pools = res.pools;
@@ -1,9 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fetchers = exports.jobs = exports.platforms = void 0;
4
+ // import { platform } from './constants';
5
+ // import marketsJob from './marketsJob';
6
+ // import loansFetcher from './loansFetcher';
4
7
  // export const platforms: Platform[] = [platform];
5
8
  // export const jobs: Job[] = [marketsJob];
6
9
  // export const fetchers: Fetcher[] = [loansFetcher];
10
+ // WIP !!
11
+ // TODO
7
12
  exports.platforms = [];
8
13
  exports.jobs = [];
9
14
  exports.fetchers = [];
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/texture/index.ts"],"names":[],"mappings":";;;AAOA,mDAAmD;AACnD,2CAA2C;AAC3C,qDAAqD;AAExC,QAAA,SAAS,GAAe,EAAE,CAAC;AAC3B,QAAA,IAAI,GAAU,EAAE,CAAC;AACjB,QAAA,QAAQ,GAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/texture/index.ts"],"names":[],"mappings":";;;AAGA,0CAA0C;AAC1C,yCAAyC;AACzC,6CAA6C;AAE7C,mDAAmD;AACnD,2CAA2C;AAC3C,qDAAqD;AAErD,SAAS;AACT,OAAO;AACM,QAAA,SAAS,GAAe,EAAE,CAAC;AAC3B,QAAA,IAAI,GAAU,EAAE,CAAC;AACjB,QAAA,QAAQ,GAAc,EAAE,CAAC"}
@@ -40,28 +40,28 @@ function getPairKey(version) {
40
40
  exports.getPairKey = getPairKey;
41
41
  function getPairsV2FromTheGraph(url, length = 300) {
42
42
  return __awaiter(this, void 0, void 0, function* () {
43
- const query = (0, graphql_request_1.gql) `
44
- {
45
- pairs(
46
- orderBy: reserveUSD
47
- first: ${length}
48
- orderDirection: desc
49
- where: { trackedReserveETH_not: "0" }
50
- ) {
51
- id
52
- reserve0
53
- reserve1
54
- totalSupply
55
- token0 {
56
- id
57
- decimals
58
- }
59
- token1 {
60
- id
61
- decimals
62
- }
63
- }
64
- }
43
+ const query = (0, graphql_request_1.gql) `
44
+ {
45
+ pairs(
46
+ orderBy: reserveUSD
47
+ first: ${length}
48
+ orderDirection: desc
49
+ where: { trackedReserveETH_not: "0" }
50
+ ) {
51
+ id
52
+ reserve0
53
+ reserve1
54
+ totalSupply
55
+ token0 {
56
+ id
57
+ decimals
58
+ }
59
+ token1 {
60
+ id
61
+ decimals
62
+ }
63
+ }
64
+ }
65
65
  `;
66
66
  const res = yield (0, graphql_request_1.default)(url, query);
67
67
  const pairs = res.pairs;
@@ -1,2 +1,2 @@
1
1
  import { AptosClient } from '../clients/types';
2
- export declare function getAccountResources(client: AptosClient, accountAddress: string): Promise<import("@aptos-labs/ts-sdk").MoveResource[] | null>;
2
+ export declare function getAccountResources(client: AptosClient, accountAddress: string): Promise<import("@aptos-labs/ts-sdk/dist/common/accountAddress-ccLvlUQe").u[] | null>;