@sonarwatch/portfolio-plugins 0.11.172 → 0.11.174

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. package/CHANGELOG.md +1415 -1407
  2. package/README.md +3 -3
  3. package/package.json +2 -2
  4. package/src/Cache.d.ts +8 -0
  5. package/src/Cache.js +8 -0
  6. package/src/Cache.js.map +1 -1
  7. package/src/plugins/armada-staking/constants.d.ts +8 -0
  8. package/src/plugins/armada-staking/constants.js +37 -1
  9. package/src/plugins/armada-staking/constants.js.map +1 -1
  10. package/src/plugins/armada-staking/index.js +4 -0
  11. package/src/plugins/armada-staking/index.js.map +1 -1
  12. package/src/plugins/armada-staking/stakingFetcher.js +1 -1
  13. package/src/plugins/armada-staking/stakingFetcher.js.map +1 -1
  14. package/src/plugins/balancer/helpers/pools.js +21 -21
  15. package/src/plugins/daos/filters.d.ts +4 -4
  16. package/src/plugins/daos/filters.js +9 -9
  17. package/src/plugins/daos/filters.js.map +1 -1
  18. package/src/plugins/daos/realmsDepositsFetcher.js +1 -1
  19. package/src/plugins/daos/realmsDepositsFetcher.js.map +1 -1
  20. package/src/plugins/daos/realmsProgramsJob.js +2 -2
  21. package/src/plugins/daos/realmsProgramsJob.js.map +1 -1
  22. package/src/plugins/jupiter/helpers.d.ts +1 -1
  23. package/src/plugins/jupiter/helpers.js +6 -2
  24. package/src/plugins/jupiter/helpers.js.map +1 -1
  25. package/src/plugins/jupiter/launchpad/allocationsFetcher.js +1 -2
  26. package/src/plugins/jupiter/launchpad/allocationsFetcher.js.map +1 -1
  27. package/src/plugins/jupiter/launchpad/constants.d.ts +1 -2
  28. package/src/plugins/jupiter/launchpad/constants.js +4 -3
  29. package/src/plugins/jupiter/launchpad/constants.js.map +1 -1
  30. package/src/plugins/mango/banksJob.js +15 -5
  31. package/src/plugins/mango/banksJob.js.map +1 -1
  32. package/src/plugins/mango/collateralFetcher.js +4 -4
  33. package/src/plugins/mango/collateralFetcher.js.map +1 -1
  34. package/src/plugins/mango/constants.d.ts +1 -1
  35. package/src/plugins/mango/constants.js +2 -2
  36. package/src/plugins/mango/constants.js.map +1 -1
  37. package/src/plugins/marginfi/banksJob.js +34 -9
  38. package/src/plugins/marginfi/banksJob.js.map +1 -1
  39. package/src/plugins/marginfi/constants.d.ts +1 -1
  40. package/src/plugins/marginfi/constants.js +2 -2
  41. package/src/plugins/marginfi/constants.js.map +1 -1
  42. package/src/plugins/marginfi/depositsFetcher.js +12 -41
  43. package/src/plugins/marginfi/depositsFetcher.js.map +1 -1
  44. package/src/plugins/marginfi/filters.js +4 -0
  45. package/src/plugins/marginfi/filters.js.map +1 -1
  46. package/src/plugins/marginfi/helpers.d.ts +1 -1
  47. package/src/plugins/marginfi/helpers.js +41 -31
  48. package/src/plugins/marginfi/helpers.js.map +1 -1
  49. package/src/plugins/marginfi/structs/Bank.d.ts +19 -12
  50. package/src/plugins/marginfi/structs/Bank.js +19 -12
  51. package/src/plugins/marginfi/structs/Bank.js.map +1 -1
  52. package/src/plugins/marginfi/types.d.ts +7 -3
  53. package/src/plugins/rain/helpers.d.ts +1 -1
  54. package/src/plugins/rain/helpers.js +1 -1
  55. package/src/plugins/rain/helpers.js.map +1 -1
  56. package/src/plugins/rain/poolsFetcher.js +1 -3
  57. package/src/plugins/rain/poolsFetcher.js.map +1 -1
  58. package/src/plugins/solend/marketsJob.js +1 -1
  59. package/src/plugins/solend/marketsJob.js.map +1 -1
  60. package/src/plugins/solend/reservesJob.js +24 -14
  61. package/src/plugins/solend/reservesJob.js.map +1 -1
  62. package/src/plugins/suilend/marketsJob.js +1 -1
  63. package/src/plugins/suilend/marketsJob.js.map +1 -1
  64. package/src/plugins/sushiswap/helpers.js +24 -24
  65. package/src/plugins/uniswap-v2/helpers.js +22 -22
  66. package/src/utils/sei/constants.js +8 -8
  67. package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"banksJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/mango/banksJob.ts"],"names":[],"mappings":";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,QAAQ,EAAE,CAAC;QAEd,IAAI,cAAc,IAAI,EAAE,IAAI,eAAe,IAAI,EAAE;YAAE,SAAS;QAE5D,MAAM,IAAI,GAAmB;YAC3B,YAAY;YACZ,WAAW,EAAE;gBACX,GAAG,EAAE,IAAA,yBAAQ,EAAC,SAAS,CAAC;gBACxB,GAAG,EAAE,SAAS;aACf;YACD,cAAc;YACd,YAAY,EAAE;gBACZ,GAAG,EAAE,IAAA,yBAAQ,EAAC,UAAU,CAAC;gBACzB,GAAG,EAAE,UAAU;aAChB;YACD,eAAe;YACf,UAAU,EAAV,sBAAU;YACV,QAAQ,EAAE,MAAM;SACjB,CAAC;QACF,SAAS,CAAC,IAAI,CAAC;YACb,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,YAAY,EAAE;YAC/C,KAAK,EAAE,IAAI;SACZ,CAAC,CAAC;IACL,CAAC;IACD,MAAM,KAAK,CAAC,OAAO,CAAC,oBAAQ,EAAE,KAAK,EAAE;QACnC,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;IACH,MAAM,KAAK,CAAC,QAAQ,CAAC,SAAS,EAAE;QAC9B,MAAM,EAAE,sCAAqB;QAC7B,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
@@ -26,15 +26,15 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
26
26
  const userAccounts = yield (0, solana_1.getParsedProgramAccounts)(client, struct_1.mangoAccountStruct, constants_1.mangoV4Pid, (0, filters_1.accountsFilter)(owner));
27
27
  if (userAccounts.length === 0)
28
28
  return [];
29
- const banks = yield cache.getAllItems({
30
- prefix: constants_1.banksPrefix,
29
+ const banks = yield cache.getItem(constants_1.banksKey, {
30
+ prefix: constants_1.platformId,
31
31
  networkId: portfolio_core_1.NetworkId.solana,
32
32
  });
33
+ if (!banks)
34
+ return [];
33
35
  const tokensMints = new Set();
34
36
  const bankByIndex = new Map();
35
37
  banks.forEach((bank) => {
36
- if (!bank)
37
- return;
38
38
  bankByIndex.set(bank.tokenIndex, bank);
39
39
  tokensMints.add(bank.mint.toString());
40
40
  });
@@ -1 +1 @@
1
- {"version":3,"file":"collateralFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/mango/collateralFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,gEAAqC;AAGrC,2CAAkE;AAClE,iDAAsD;AACtD,qCAA8C;AAC9C,uCAA2C;AAC3C,+CAA+E;AAC/E,qGAA6E;AAC7E,6EAAqD;AAGrD,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IACjC,MAAM,YAAY,GAAG,MAAM,IAAA,iCAAwB,EACjD,MAAM,EACN,2BAAkB,EAClB,sBAAU,EACV,IAAA,wBAAc,EAAC,KAAK,CAAC,CACtB,CAAC;IACF,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEzC,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,WAAW,CAAe;QAClD,MAAM,EAAE,uBAAW;QACnB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;IACH,MAAM,WAAW,GAAgB,IAAI,GAAG,EAAE,CAAC;IAC3C,MAAM,WAAW,GAA8B,IAAI,GAAG,EAAE,CAAC;IACzD,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACrB,IAAI,CAAC,IAAI;YAAE,OAAO;QAClB,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,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AAI,EAAE,qCAAoB,CAAC,UAAU;YACrC,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,KAAK,EAAE,SAAS;YAChB,KAAK;YACL,IAAI,EAAE;gBACJ,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,eAAe,EAAE,IAAI;gBAErB,WAAW;gBACX,YAAY;gBACZ,WAAW;gBACX,KAAK;aACN;YACD,IAAI,EAAE,IAAA,wBAAe,EAAC,WAAW,CAAC,IAAI,CAAC;SACxC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,aAAa;IAC9B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"collateralFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/mango/collateralFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,gEAAqC;AAGrC,2CAA+D;AAC/D,iDAAsD;AACtD,qCAA8C;AAC9C,uCAA2C;AAC3C,+CAA+E;AAC/E,qGAA6E;AAC7E,6EAAqD;AAGrD,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IACjC,MAAM,YAAY,GAAG,MAAM,IAAA,iCAAwB,EACjD,MAAM,EACN,2BAAkB,EAClB,sBAAU,EACV,IAAA,wBAAc,EAAC,KAAK,CAAC,CACtB,CAAC;IACF,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEzC,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,OAAO,CAAiB,oBAAQ,EAAE;QAC1D,MAAM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qBACF,CAAC,CAAC;YACP,CAAC;QACH,CAAC;QAED,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QAEzE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,GACrE,IAAA,wCAAuB,EAAC,cAAc,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;QACxE,QAAQ,CAAC,IAAI,CAAC;YACZ,IAAI,EAAE,qCAAoB,CAAC,UAAU;YACrC,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,KAAK,EAAE,SAAS;YAChB,KAAK;YACL,IAAI,EAAE;gBACJ,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,eAAe,EAAE,IAAI;gBAErB,WAAW;gBACX,YAAY;gBACZ,WAAW;gBACX,KAAK;aACN;YACD,IAAI,EAAE,IAAA,wBAAe,EAAC,WAAW,CAAC,IAAI,CAAC;SACxC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,aAAa;IAC9B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -2,7 +2,7 @@ import { PublicKey } from '@solana/web3.js';
2
2
  import { Platform } from '@sonarwatch/portfolio-core';
3
3
  export declare const platformId = "mango";
4
4
  export declare const mangoPlatform: Platform;
5
- export declare const banksPrefix = "mango-banks";
5
+ export declare const banksKey = "banks";
6
6
  export declare const rootBankPrefix = "mango-rootBank";
7
7
  export declare const groupPrefix = "mango-group";
8
8
  export declare const boostBanksKey = "boost-banks";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.boostProgramId = exports.redeemProgramId = exports.mangoV4Pid = exports.boostBanksKey = exports.groupPrefix = exports.rootBankPrefix = exports.banksPrefix = exports.mangoPlatform = exports.platformId = void 0;
3
+ exports.boostProgramId = exports.redeemProgramId = exports.mangoV4Pid = exports.boostBanksKey = exports.groupPrefix = exports.rootBankPrefix = exports.banksKey = exports.mangoPlatform = exports.platformId = void 0;
4
4
  const web3_js_1 = require("@solana/web3.js");
5
5
  exports.platformId = 'mango';
6
6
  exports.mangoPlatform = {
@@ -10,7 +10,7 @@ exports.mangoPlatform = {
10
10
  defiLlamaId: 'parent#mango-markets',
11
11
  website: 'https://mango.markets/',
12
12
  };
13
- exports.banksPrefix = `${exports.platformId}-banks`;
13
+ exports.banksKey = `banks`;
14
14
  exports.rootBankPrefix = `${exports.platformId}-rootBank`;
15
15
  exports.groupPrefix = `${exports.platformId}-group`;
16
16
  exports.boostBanksKey = 'boost-banks';
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/mango/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,aAAa,GAAa;IACrC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,6CAA6C;IACpD,WAAW,EAAE,sBAAsB;IACnC,OAAO,EAAE,wBAAwB;CAClC,CAAC;AACW,QAAA,WAAW,GAAG,GAAG,kBAAU,QAAQ,CAAC;AACpC,QAAA,cAAc,GAAG,GAAG,kBAAU,WAAW,CAAC;AAC1C,QAAA,WAAW,GAAG,GAAG,kBAAU,QAAQ,CAAC;AACpC,QAAA,aAAa,GAAG,aAAa,CAAC;AAE9B,QAAA,UAAU,GAAG,IAAI,mBAAS,CACrC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,eAAe,GAAG,IAAI,mBAAS,CAC1C,6CAA6C,CAC9C,CAAC;AAEW,QAAA,cAAc,GAAG,IAAI,mBAAS,CACzC,6CAA6C,CAC9C,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/mango/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,aAAa,GAAa;IACrC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,6CAA6C;IACpD,WAAW,EAAE,sBAAsB;IACnC,OAAO,EAAE,wBAAwB;CAClC,CAAC;AACW,QAAA,QAAQ,GAAG,OAAO,CAAC;AACnB,QAAA,cAAc,GAAG,GAAG,kBAAU,WAAW,CAAC;AAC1C,QAAA,WAAW,GAAG,GAAG,kBAAU,QAAQ,CAAC;AACpC,QAAA,aAAa,GAAG,aAAa,CAAC;AAE9B,QAAA,UAAU,GAAG,IAAI,mBAAS,CACrC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,eAAe,GAAG,IAAI,mBAAS,CAC1C,6CAA6C,CAC9C,CAAC;AAEW,QAAA,cAAc,GAAG,IAAI,mBAAS,CACzC,6CAA6C,CAC9C,CAAC"}
@@ -19,20 +19,37 @@ const clients_1 = require("../../utils/clients");
19
19
  const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
20
20
  const connection = (0, clients_1.getClientSolana)();
21
21
  const banksRawData = yield (0, solana_1.getParsedProgramAccounts)(connection, Bank_1.bankStruct, constants_1.MarginfiProgram, (0, filters_1.banksFilters)());
22
+ const banks = [];
23
+ const rateItems = [];
22
24
  for (let index = 0; index < banksRawData.length; index += 1) {
23
25
  const bank = banksRawData[index];
24
- yield cache.setItem(bank.pubkey.toString(), Object.assign(Object.assign({}, bank), { dividedAssetShareValue: (0, helpers_1.wrappedI80F48toBigNumber)(bank.assetShareValue).div(Math.pow(10, bank.mintDecimals)), dividedLiabilityShareValue: (0, helpers_1.wrappedI80F48toBigNumber)(bank.liabilityShareValue).div(Math.pow(10, bank.mintDecimals)) }), {
25
- prefix: constants_1.prefix,
26
- networkId: portfolio_core_1.NetworkId.solana,
27
- });
28
- const { lendingApr, borrowingApr } = (0, helpers_1.getInterestRates)(bank);
26
+ const { lendingApr, borrowingApr } = (0, helpers_1.computeInterestRates)(bank);
27
+ banks.push(Object.assign(Object.assign({}, bank), { dividedAssetShareValue: (0, helpers_1.wrappedI80F48toBigNumber)(bank.assetShareValue)
28
+ .div(Math.pow(10, bank.mintDecimals))
29
+ .toString(), dividedLiabilityShareValue: (0, helpers_1.wrappedI80F48toBigNumber)(bank.liabilityShareValue)
30
+ .div(Math.pow(10, bank.mintDecimals))
31
+ .toString(), suppliedLtv: (0, helpers_1.wrappedI80F48toBigNumber)(bank.config.assetWeightMaint)
32
+ .decimalPlaces(2)
33
+ .toNumber(), suppliedYields: [
34
+ {
35
+ apy: (0, portfolio_core_1.aprToApy)(lendingApr),
36
+ apr: lendingApr,
37
+ },
38
+ ], borrowedWeight: (0, helpers_1.wrappedI80F48toBigNumber)(bank.config.liabilityWeightMaint)
39
+ .decimalPlaces(2)
40
+ .toNumber(), borrowedYields: [
41
+ {
42
+ apy: -(0, portfolio_core_1.aprToApy)(borrowingApr),
43
+ apr: -borrowingApr,
44
+ },
45
+ ] }));
29
46
  const depositedAmount = (0, helpers_1.wrappedI80F48toBigNumber)(bank.liabilityShareValue)
30
47
  .times((0, helpers_1.wrappedI80F48toBigNumber)(bank.totalLiabilityShares))
31
48
  .toNumber();
32
49
  const borrowedAmount = (0, helpers_1.wrappedI80F48toBigNumber)(bank.assetShareValue)
33
50
  .times((0, helpers_1.wrappedI80F48toBigNumber)(bank.totalAssetShares))
34
51
  .toNumber();
35
- if (borrowedAmount <= 10 && depositedAmount <= 10)
52
+ if (borrowedAmount <= 1 && depositedAmount <= 1)
36
53
  continue;
37
54
  const tokenAddress = bank.mint.toString();
38
55
  const poolName = bank.config.riskTier === 0 ? 'Global Pool' : 'Isolated Pool';
@@ -51,11 +68,19 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
51
68
  platformId: constants_1.platformId,
52
69
  poolName,
53
70
  };
54
- yield cache.setItem(`${bank.pubkey.toString()}-${tokenAddress}`, rate, {
55
- prefix: portfolio_core_1.borrowLendRatesPrefix,
56
- networkId: portfolio_core_1.NetworkId.solana,
71
+ rateItems.push({
72
+ key: `${bank.pubkey.toString()}-${tokenAddress}`,
73
+ value: rate,
57
74
  });
58
75
  }
76
+ yield cache.setItem(constants_1.banksKey, banks, {
77
+ prefix: constants_1.platformId,
78
+ networkId: portfolio_core_1.NetworkId.solana,
79
+ });
80
+ yield cache.setItems(rateItems, {
81
+ prefix: portfolio_core_1.borrowLendRatesPrefix,
82
+ networkId: portfolio_core_1.NetworkId.solana,
83
+ });
59
84
  });
60
85
  const job = {
61
86
  id: `${constants_1.platformId}-banks`,
@@ -1 +1 @@
1
- {"version":3,"file":"banksJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/marginfi/banksJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAKoC;AACpC,2CAAkE;AAClE,yCAA4C;AAC5C,uCAAyC;AACzC,uCAAuE;AACvE,+CAA8D;AAC9D,iDAAsD;AAItD,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IAErC,MAAM,YAAY,GAAG,MAAM,IAAA,iCAAwB,EACjD,UAAU,EACV,iBAAU,EACV,2BAAe,EACf,IAAA,sBAAY,GAAE,CACf,CAAC;IAEF,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,YAAY,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QAC5D,MAAM,IAAI,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;QACjC,MAAM,KAAK,CAAC,OAAO,CACjB,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,kCAEjB,IAAI,KACP,sBAAsB,EAAE,IAAA,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Y,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE1C,MAAM,QAAQ,GACZ,IAAI,CAAC,MAAM,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,eAAe,CAAC;QAE/D,MAAM,IAAI,GAAmB;YAC3B,YAAY;YACZ,WAAW,EAAE;gBACX,GAAG,EAAE,IAAA,yBAAQ,EAAC,YAAY,CAAC;gBAC3B,GAAG,EAAE,YAAY;aAClB;YACD,cAAc;YACd,YAAY,EAAE;gBACZ,GAAG,EAAE,IAAA,yBAAQ,EAAC,UAAU,CAAC;gBACzB,GAAG,EAAE,UAAU;aAChB;YACD,eAAe;YACf,UAAU,EAAV,sBAAU;YACV,QAAQ;SACT,CAAC;QAEF,SAAS,CAAC,IAAI,CAAC;YACb,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,YAAY,EAAE;YAChD,KAAK,EAAE,IAAI;SACZ,CAAC,CAAC;IACL,CAAC;IACD,MAAM,KAAK,CAAC,OAAO,CAAC,oBAAQ,EAAE,KAAK,EAAE;QACnC,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;IACH,MAAM,KAAK,CAAC,QAAQ,CAAC,SAAS,EAAE;QAC9B,MAAM,EAAE,sCAAqB;QAC7B,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { PublicKey } from '@solana/web3.js';
2
2
  import { Platform } from '@sonarwatch/portfolio-core';
3
3
  import BigNumber from 'bignumber.js';
4
- export declare const prefix = "marginfi-banks";
4
+ export declare const banksKey = "banks";
5
5
  export declare const platformId = "marginfi";
6
6
  export declare const marginfiPlatform: Platform;
7
7
  export declare const MarginfiProgram: PublicKey;
@@ -3,11 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.solFactor = exports.MarginfiAccountAddress = exports.MarginfiProgram = exports.marginfiPlatform = exports.platformId = exports.prefix = void 0;
6
+ exports.solFactor = exports.MarginfiAccountAddress = exports.MarginfiProgram = exports.marginfiPlatform = exports.platformId = exports.banksKey = void 0;
7
7
  const web3_js_1 = require("@solana/web3.js");
8
8
  const portfolio_core_1 = require("@sonarwatch/portfolio-core");
9
9
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
10
- exports.prefix = 'marginfi-banks';
10
+ exports.banksKey = 'banks';
11
11
  exports.platformId = 'marginfi';
12
12
  exports.marginfiPlatform = {
13
13
  id: exports.platformId,
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/marginfi/constants.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA4C;AAC5C,+DAAqE;AACrE,gEAAqC;AAExB,QAAA,MAAM,GAAG,gBAAgB,CAAC;AAC1B,QAAA,UAAU,GAAG,UAAU,CAAC;AACxB,QAAA,gBAAgB,GAAa;IACxC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,gDAAgD;IACvD,WAAW,EAAE,iBAAiB;IAC9B,OAAO,EAAE,2BAA2B;CACrC,CAAC;AACW,QAAA,eAAe,GAAG,IAAI,mBAAS,CAC1C,6CAA6C,CAC9C,CAAC;AAEW,QAAA,sBAAsB,GACjC,8CAA8C,CAAC;AAEpC,QAAA,SAAS,GAAG,IAAI,sBAAS,CAAC,SAAA,EAAE,EAAI,8BAAa,CAAC,MAAM,CAAC,QAAQ,CAAA,CAAC,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/marginfi/constants.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA4C;AAC5C,+DAAqE;AACrE,gEAAqC;AAExB,QAAA,QAAQ,GAAG,OAAO,CAAC;AACnB,QAAA,UAAU,GAAG,UAAU,CAAC;AACxB,QAAA,gBAAgB,GAAa;IACxC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,gDAAgD;IACvD,WAAW,EAAE,iBAAiB;IAC9B,OAAO,EAAE,2BAA2B;CACrC,CAAC;AACW,QAAA,eAAe,GAAG,IAAI,mBAAS,CAC1C,6CAA6C,CAC9C,CAAC;AAEW,QAAA,sBAAsB,GACjC,8CAA8C,CAAC;AAEpC,QAAA,SAAS,GAAG,IAAI,sBAAS,CAAC,SAAA,EAAE,EAAI,8BAAa,CAAC,MAAM,CAAC,QAAQ,CAAA,CAAC,CAAC"}
@@ -13,7 +13,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const portfolio_core_1 = require("@sonarwatch/portfolio-core");
16
- const web3_js_1 = require("@solana/web3.js");
17
16
  const constants_1 = require("./constants");
18
17
  const MarginfiAccount_1 = require("./structs/MarginfiAccount");
19
18
  const helpers_1 = require("./helpers");
@@ -21,19 +20,16 @@ const filters_1 = require("./filters");
21
20
  const solana_1 = require("../../utils/solana");
22
21
  const clients_1 = require("../../utils/clients");
23
22
  const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
24
- const getTokensPricesMap_1 = __importDefault(require("../../utils/misc/getTokensPricesMap"));
25
- const helpers_2 = require("../../utils/solana/pyth/helpers");
26
- const Bank_1 = require("./structs/Bank");
27
23
  const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
28
24
  const client = (0, clients_1.getClientSolana)();
29
25
  const accounts = yield (0, solana_1.getParsedProgramAccounts)(client, MarginfiAccount_1.marginfiAccountStruct, constants_1.MarginfiProgram, (0, filters_1.accountsFilter)(owner));
30
26
  if (accounts.length === 0)
31
27
  return [];
32
- const banksInfo = yield cache.getAllItems({
33
- prefix: constants_1.prefix,
28
+ const banksInfo = yield cache.getItem(constants_1.banksKey, {
29
+ prefix: constants_1.platformId,
34
30
  networkId: portfolio_core_1.NetworkId.solana,
35
31
  });
36
- if (banksInfo.length === 0)
32
+ if (!banksInfo || banksInfo.length === 0)
37
33
  return [];
38
34
  const banksInfoByAddress = new Map();
39
35
  const tokensAddresses = new Set();
@@ -43,7 +39,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
43
39
  banksInfoByAddress.set(bankInfo.pubkey.toString(), bankInfo);
44
40
  tokensAddresses.add(bankInfo.mint.toString());
45
41
  });
46
- const tokenPriceById = yield (0, getTokensPricesMap_1.default)(Array.from(tokensAddresses), portfolio_core_1.NetworkId.solana, cache);
42
+ const tokenPriceById = yield cache.getTokenPricesAsMap(Array.from(tokensAddresses), portfolio_core_1.NetworkId.solana);
47
43
  const elements = [];
48
44
  for (const account of accounts) {
49
45
  const { balances } = account.lendingAccount;
@@ -63,47 +59,22 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
63
59
  const bankInfo = banksInfoByAddress.get(balance.bankPk.toString());
64
60
  if (!bankInfo)
65
61
  continue;
66
- const { lendingApr, borrowingApr } = (0, helpers_1.getInterestRates)(bankInfo);
67
62
  const tokenPrice = tokenPriceById.get(bankInfo.mint.toString());
68
- let price;
69
- if (!tokenPrice && bankInfo.config.oracleSetup === Bank_1.OracleSetup.PythEma) {
70
- const pythOracle = new web3_js_1.PublicKey(bankInfo.config.oracleKeys[0]);
71
- const pythAccount = yield client.getAccountInfo(pythOracle);
72
- const pythPrice = pythAccount ? (0, helpers_2.parsePriceData)(pythAccount.data) : null;
73
- if (pythPrice)
74
- price = pythPrice.price;
75
- }
76
63
  if (!balance.assetShares.value.isZero()) {
77
- suppliedLtvs.push((0, helpers_1.wrappedI80F48toBigNumber)(bankInfo.config.assetWeightMaint)
78
- .decimalPlaces(2)
79
- .toNumber());
80
- const suppliedQuantity = (0, helpers_1.wrappedI80F48toBigNumber)(balance.assetShares)
64
+ suppliedLtvs.push(bankInfo.suppliedLtv);
65
+ const suppliedAmount = (0, helpers_1.wrappedI80F48toBigNumber)(balance.assetShares)
81
66
  .times(bankInfo.dividedAssetShareValue)
82
67
  .toNumber();
83
- suppliedAssets.push((0, tokenPriceToAssetToken_1.default)(bankInfo.mint.toString(), suppliedQuantity, portfolio_core_1.NetworkId.solana, tokenPrice, price));
84
- const bankLendingYields = [
85
- {
86
- apr: lendingApr,
87
- apy: (0, portfolio_core_1.aprToApy)(lendingApr),
88
- },
89
- ];
90
- suppliedYields.push(bankLendingYields);
68
+ suppliedAssets.push((0, tokenPriceToAssetToken_1.default)(bankInfo.mint.toString(), suppliedAmount, portfolio_core_1.NetworkId.solana, tokenPrice));
69
+ suppliedYields.push(bankInfo.suppliedYields);
91
70
  }
92
71
  if (!balance.liabilityShares.value.isZero()) {
93
- borrowedWeights.push((0, helpers_1.wrappedI80F48toBigNumber)(bankInfo.config.liabilityWeightMaint)
94
- .decimalPlaces(2)
95
- .toNumber());
96
- const borrowedQuantity = (0, helpers_1.wrappedI80F48toBigNumber)(balance.liabilityShares)
72
+ borrowedWeights.push(bankInfo.borrowedWeight);
73
+ const borrowedAmount = (0, helpers_1.wrappedI80F48toBigNumber)(balance.liabilityShares)
97
74
  .times(bankInfo.dividedLiabilityShareValue)
98
75
  .toNumber();
99
- borrowedAssets.push((0, tokenPriceToAssetToken_1.default)(bankInfo.mint.toString(), borrowedQuantity, portfolio_core_1.NetworkId.solana, tokenPrice, price));
100
- const bankBorrowedYields = [
101
- {
102
- apr: -borrowingApr,
103
- apy: -(0, portfolio_core_1.aprToApy)(borrowingApr),
104
- },
105
- ];
106
- borrowedYields.push(bankBorrowedYields);
76
+ borrowedAssets.push((0, tokenPriceToAssetToken_1.default)(bankInfo.mint.toString(), borrowedAmount, portfolio_core_1.NetworkId.solana, tokenPrice));
77
+ borrowedYields.push(bankInfo.borrowedYields);
107
78
  }
108
79
  }
109
80
  if (suppliedAssets.length === 0 && borrowedAssets.length === 0)
@@ -1 +1 @@
1
- {"version":3,"file":"depositsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/marginfi/depositsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAQoC;AACpC,6CAA4C;AAC5C,2CAAkE;AAClE,+DAAkE;AAClE,uCAAuE;AACvE,uCAA2C;AAE3C,+CAA6E;AAC7E,iDAAsD;AACtD,qGAA6E;AAG7E,6FAAoE;AACpE,6DAAiE;AACjE,yCAA6C;AAE7C,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IACjC,MAAM,QAAQ,GAAG,MAAM,IAAA,iCAAwB,EAC7C,MAAM,EACN,uCAAqB,EACrB,2BAAe,EACf,IAAA,wBAAc,EAAC,KAAK,CAAC,CACtB,CAAC;IACF,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAErC,MAAM,SAAS,GAAG,MAAM,KAAK,CAAC,WAAW,CAA0B;QACjE,MAAM,EAAN,kBAAM;QACN,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;IACH,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEtC,MAAM,kBAAkB,GAA0B,IAAI,GAAG,EAAE,CAAC;IAC5D,MAAM,eAAe,GAAgB,IAAI,GAAG,EAAE,CAAC;IAC/C,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC7B,IAAI,CAAC,QAAQ;YAAE,OAAO;QACtB,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC,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CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,KAAK,EAAE,SAAS;YAChB,KAAK;YACL,IAAI,EAAE;gBACJ,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,eAAe,EAAE,IAAI;gBACrB,WAAW;gBACX,YAAY;gBACZ,WAAW;gBACX,KAAK;aACN;SACF,CAAC;QACF,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,WAAW;IAC5B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"depositsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/marginfi/depositsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAOoC;AACpC,2CAAoE;AACpE,+DAAkE;AAClE,uCAAqD;AACrD,uCAA2C;AAE3C,+CAA6E;AAC7E,iDAAsD;AACtD,qGAA6E;AAI7E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IACjC,MAAM,QAAQ,GAAG,MAAM,IAAA,iCAAwB,EAC7C,MAAM,EACN,uCAAqB,EACrB,2BAAe,EACf,IAAA,wBAAc,EAAC,KAAK,CAAC,CACtB,CAAC;IACF,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAErC,MAAM,SAAS,GAAG,MAAM,KAAK,CAAC,OAAO,CAA4B,oBAAQ,EAAE;QACzE,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;IACH,IAAI,CAAC,S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ACd,0BAAS,CAAC,MAAM,EAChB,UAAU,CACX,CACF,CAAC;gBACF,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;YAC/C,CAAC;QACH,CAAC;QAED,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QAEzE,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,GACrE,IAAA,wCAAuB,EACrB,cAAc,EACd,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,eAAe,CAChB,CAAC;QAEJ,MAAM,OAAO,GAAqB;YAChC,IAAI,EAAE,qCAAoB,CAAC,UAAU;YACrC,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,KAAK,EAAE,SAAS;YAChB,KAAK;YACL,IAAI,EAAE;gBACJ,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,eAAe,EAAE,IAAI;gBACrB,WAAW;gBACX,YAAY;gBACZ,WAAW;gBACX,KAAK;aACN;SACF,CAAC;QACF,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,WAAW;IAC5B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.banksFilters = exports.accountsFilter = void 0;
4
4
  const constants_1 = require("./constants");
5
+ const Bank_1 = require("./structs/Bank");
5
6
  const accountsFilter = (owner) => [
6
7
  {
7
8
  memcmp: {
@@ -36,6 +37,9 @@ const banksFilters = () => [
36
37
  offset: 41,
37
38
  },
38
39
  },
40
+ {
41
+ dataSize: Bank_1.bankStruct.byteSize,
42
+ },
39
43
  ];
40
44
  exports.banksFilters = banksFilters;
41
45
  //# sourceMappingURL=filters.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/marginfi/filters.ts"],"names":[],"mappings":";;;AACA,2CAAqD;AAE9C,MAAM,cAAc,GAAG,CAAC,KAAa,EAA8B,EAAE,CAAC;IAC3E;QACE,MAAM,EAAE;YACN,KAAK,EAAE,aAAa;YACpB,MAAM,EAAE,CAAC;SACV;KACF;IACD;QACE,MAAM,EAAE;YACN,KAAK,EAAE,kCAAsB;YAC7B,MAAM,EAAE,CAAC;SACV;KACF;IACD;QACE,MAAM,EAAE;YACN,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,EAAE;SACX;KACF;CACF,CAAC;AAnBW,QAAA,cAAc,kBAmBzB;AAEK,MAAM,YAAY,GAAG,GAA+B,EAAE,CAAC;IAC5D;QACE,MAAM,EAAE;YACN,KAAK,EAAE,aAAa;YACpB,MAAM,EAAE,CAAC;SACV;KACF;IACD;QACE,MAAM,EAAE;YACN,KAAK,EAAE,kCAAsB;YAC7B,MAAM,EAAE,EAAE;SACX;KACF;CACF,CAAC;AAbW,QAAA,YAAY,gBAavB"}
1
+ {"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/marginfi/filters.ts"],"names":[],"mappings":";;;AACA,2CAAqD;AACrD,yCAA4C;AAErC,MAAM,cAAc,GAAG,CAAC,KAAa,EAA8B,EAAE,CAAC;IAC3E;QACE,MAAM,EAAE;YACN,KAAK,EAAE,aAAa;YACpB,MAAM,EAAE,CAAC;SACV;KACF;IACD;QACE,MAAM,EAAE;YACN,KAAK,EAAE,kCAAsB;YAC7B,MAAM,EAAE,CAAC;SACV;KACF;IACD;QACE,MAAM,EAAE;YACN,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,EAAE;SACX;KACF;CACF,CAAC;AAnBW,QAAA,cAAc,kBAmBzB;AAEK,MAAM,YAAY,GAAG,GAA+B,EAAE,CAAC;IAC5D;QACE,MAAM,EAAE;YACN,KAAK,EAAE,aAAa;YACpB,MAAM,EAAE,CAAC;SACV;KACF;IACD;QACE,MAAM,EAAE;YACN,KAAK,EAAE,kCAAsB;YAC7B,MAAM,EAAE,EAAE;SACX;KACF;IACD;QACE,QAAQ,EAAE,iBAAU,CAAC,QAAQ;KAC9B;CACF,CAAC;AAhBW,QAAA,YAAY,gBAgBvB"}
@@ -3,7 +3,7 @@ import { Bank } from './structs/Bank';
3
3
  export declare function wrappedI80F48toBigNumber({ value }: {
4
4
  value: BigNumber;
5
5
  }, scaleDecimal?: number): BigNumber;
6
- export declare function getInterestRates(bank: Bank): {
6
+ export declare function computeInterestRates(bank: Bank): {
7
7
  lendingApr: number;
8
8
  borrowingApr: number;
9
9
  };
@@ -3,49 +3,59 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getInterestRates = exports.wrappedI80F48toBigNumber = void 0;
6
+ exports.computeInterestRates = exports.wrappedI80F48toBigNumber = void 0;
7
7
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
8
8
  const decimal_js_1 = __importDefault(require("decimal.js"));
9
9
  function wrappedI80F48toBigNumber({ value }, scaleDecimal = 0) {
10
10
  if (!value)
11
11
  return new bignumber_js_1.default(0);
12
- const newValue = new bignumber_js_1.default(value);
13
- const numbers = new decimal_js_1.default(`${newValue.isNegative() ? '-' : ''}0b${newValue.abs().toString(2)}p-48`).dividedBy(Math.pow(10, scaleDecimal));
12
+ const numbers = new decimal_js_1.default(`${value.isNegative() ? '-' : ''}0b${value.abs().toString(2)}p-48`).dividedBy(Math.pow(10, scaleDecimal));
14
13
  return new bignumber_js_1.default(numbers.toString());
15
14
  }
16
15
  exports.wrappedI80F48toBigNumber = wrappedI80F48toBigNumber;
17
- // AMELIORER LE PRINCIPE DENVOYER A CHAQUE FOIS LA BANK AUX FONCTIONS
18
- // AMELIORER LE PRINCIPE DE UNWRAP LES I80F48 A CHAQUE FOIS
19
- function getInterestRates(bank) {
20
- const { insuranceFeeFixedApr, insuranceIrFee, protocolFixedFeeApr, protocolIrFee, } = bank.config.interestRateConfig;
21
- const rateFee = wrappedI80F48toBigNumber(insuranceFeeFixedApr).plus(wrappedI80F48toBigNumber(protocolFixedFeeApr));
22
- const fixedFee = wrappedI80F48toBigNumber(insuranceIrFee).plus(wrappedI80F48toBigNumber(protocolIrFee));
23
- const interestRate = interestRateCurve(bank);
24
- const utilizationRate = wrappedI80F48toBigNumber(bank.liabilityShareValue)
25
- .times(wrappedI80F48toBigNumber(bank.totalLiabilityShares))
26
- .div(wrappedI80F48toBigNumber(bank.assetShareValue).times(wrappedI80F48toBigNumber(bank.totalAssetShares)));
27
- const lendingApy = interestRate.times(utilizationRate).toNumber();
28
- const borrowingApy = interestRate
29
- .times(new bignumber_js_1.default(1).plus(rateFee))
30
- .plus(fixedFee)
31
- .toNumber();
32
- return { lendingApr: lendingApy, borrowingApr: borrowingApy };
16
+ function getTotalLiabilityQuantity(bank) {
17
+ return wrappedI80F48toBigNumber(bank.totalLiabilityShares).times(wrappedI80F48toBigNumber(bank.liabilityShareValue));
18
+ }
19
+ function getTotalAssetQuantity(bank) {
20
+ return wrappedI80F48toBigNumber(bank.totalAssetShares).times(wrappedI80F48toBigNumber(bank.assetShareValue));
21
+ }
22
+ function computeUtilizationRate(bank) {
23
+ const assets = getTotalAssetQuantity(bank);
24
+ const liabilities = getTotalLiabilityQuantity(bank);
25
+ if (assets.isZero())
26
+ return new bignumber_js_1.default(0);
27
+ return liabilities.div(assets);
33
28
  }
34
- exports.getInterestRates = getInterestRates;
35
- function interestRateCurve(bank) {
29
+ function computeBaseInterestRate(bank) {
36
30
  const { optimalUtilizationRate, plateauInterestRate, maxInterestRate } = bank.config.interestRateConfig;
37
- const utilizationRate = wrappedI80F48toBigNumber(bank.liabilityShareValue)
38
- .times(wrappedI80F48toBigNumber(bank.totalLiabilityShares))
39
- .div(wrappedI80F48toBigNumber(bank.assetShareValue).times(wrappedI80F48toBigNumber(bank.totalAssetShares)));
40
- if (utilizationRate.lte(wrappedI80F48toBigNumber(optimalUtilizationRate))) {
31
+ const fOptimalUtilizationRate = wrappedI80F48toBigNumber(optimalUtilizationRate);
32
+ const fPlateauInterestRate = wrappedI80F48toBigNumber(plateauInterestRate);
33
+ const fMaxInterestRate = wrappedI80F48toBigNumber(maxInterestRate);
34
+ const utilizationRate = computeUtilizationRate(bank);
35
+ if (utilizationRate.lte(fOptimalUtilizationRate)) {
41
36
  return utilizationRate
42
- .times(wrappedI80F48toBigNumber(plateauInterestRate))
43
- .div(wrappedI80F48toBigNumber(optimalUtilizationRate));
37
+ .times(fPlateauInterestRate)
38
+ .div(fOptimalUtilizationRate);
44
39
  }
45
40
  return utilizationRate
46
- .minus(wrappedI80F48toBigNumber(optimalUtilizationRate))
47
- .div(new bignumber_js_1.default(1).minus(wrappedI80F48toBigNumber(optimalUtilizationRate)))
48
- .times(wrappedI80F48toBigNumber(maxInterestRate).minus(wrappedI80F48toBigNumber(plateauInterestRate)))
49
- .plus(wrappedI80F48toBigNumber(plateauInterestRate));
41
+ .minus(fOptimalUtilizationRate)
42
+ .div(new bignumber_js_1.default(1).minus(fOptimalUtilizationRate))
43
+ .times(fMaxInterestRate.minus(fPlateauInterestRate))
44
+ .plus(fPlateauInterestRate);
45
+ }
46
+ function computeInterestRates(bank) {
47
+ const { insuranceFeeFixedApr, insuranceIrFee, protocolFixedFeeApr, protocolIrFee, } = bank.config.interestRateConfig;
48
+ const fixedFee = wrappedI80F48toBigNumber(insuranceFeeFixedApr).plus(wrappedI80F48toBigNumber(protocolFixedFeeApr));
49
+ const rateFee = wrappedI80F48toBigNumber(insuranceIrFee).plus(wrappedI80F48toBigNumber(protocolIrFee));
50
+ const baseInterestRate = computeBaseInterestRate(bank);
51
+ const utilizationRate = computeUtilizationRate(bank);
52
+ const lendingRate = baseInterestRate.times(utilizationRate);
53
+ const borrowingRate = baseInterestRate
54
+ .times(new bignumber_js_1.default(1).plus(rateFee))
55
+ .plus(fixedFee);
56
+ const lendingApr = lendingRate.toNumber();
57
+ const borrowingApr = borrowingRate.toNumber();
58
+ return { lendingApr, borrowingApr };
50
59
  }
60
+ exports.computeInterestRates = computeInterestRates;
51
61
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/marginfi/helpers.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AACrC,4DAAiC;AAGjC,SAAgB,wBAAwB,CACtC,EAAE,KAAK,EAAwB,EAC/B,YAAY,GAAG,CAAC;IAEhB,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,sBAAS,CAAC,CAAC,CAAC,CAAC;IACpC,MAAM,QAAQ,GAAG,IAAI,sBAAS,CAAC,KAAK,CAAC,CAAC;IAEtC,MAAM,OAAO,GAAG,IAAI,oBAAO,CACzB,GAAG,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CACzE,CAAC,SAAS,CAAC,SAAA,EAAE,EAAI,YAAY,CAAA,CAAC,CAAC;IAChC,OAAO,IAAI,sBAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;AAC3C,CAAC;AAXD,4DAWC;AAED,qEAAqE;AACrE,2DAA2D;AAE3D,SAAgB,gBAAgB,CAAC,IAAU;IAIzC,MAAM,EACJ,oBAAoB,EACpB,cAAc,EACd,mBAAmB,EACnB,aAAa,GACd,GAAG,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC;IAEnC,MAAM,OAAO,GAAG,wBAAwB,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AC9B,GAAG,CAAC,IAAI,sBAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;SACpD,KAAK,CAAC,gBAAgB,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;SACnD,IAAI,CAAC,oBAAoB,CAAC,CAAC;AAChC,CAAC;AAED,SAAgB,oBAAoB,CAAC,IAAU;IAI7C,MAAM,EACJ,oBAAoB,EACpB,cAAc,EACd,mBAAmB,EACnB,aAAa,GACd,GAAG,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC;IAEnC,MAAM,QAAQ,GAAG,wBAAwB,CAAC,oBAAoB,CAAC,CAAC,IAAI,CAClE,wBAAwB,CAAC,mBAAmB,CAAC,CAC9C,CAAC;IACF,MAAM,OAAO,GAAG,wBAAwB,CAAC,cAAc,CAAC,CAAC,IAAI,CAC3D,wBAAwB,CAAC,aAAa,CAAC,CACxC,CAAC;IAEF,MAAM,gBAAgB,GAAG,uBAAuB,CAAC,IAAI,CAAC,CAAC;IACvD,MAAM,eAAe,GAAG,sBAAsB,CAAC,IAAI,CAAC,CAAC;IAErD,MAAM,WAAW,GAAG,gBAAgB,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAC5D,MAAM,aAAa,GAAG,gBAAgB;SACnC,KAAK,CAAC,IAAI,sBAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACrC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAElB,MAAM,UAAU,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;IAC1C,MAAM,YAAY,GAAG,aAAa,CAAC,QAAQ,EAAE,CAAC;IAE9C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC;AACtC,CAAC;AA9BD,oDA8BC"}
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { FixableBeetStruct } from '@metaplex-foundation/beet';
2
+ import { BeetStruct, bignum } from '@metaplex-foundation/beet';
3
3
  import { PublicKey } from '@solana/web3.js';
4
4
  import BigNumber from 'bignumber.js';
5
5
  import { WrappedI80F48 } from './common';
@@ -25,9 +25,9 @@ export type InterestRateConfig = {
25
25
  insuranceIrFee: WrappedI80F48;
26
26
  protocolFixedFeeApr: WrappedI80F48;
27
27
  protocolIrFee: WrappedI80F48;
28
- padding: BigNumber[];
28
+ padding: bignum[];
29
29
  };
30
- export declare const interestRateConfigStruct: FixableBeetStruct<InterestRateConfig, Partial<InterestRateConfig>>;
30
+ export declare const interestRateConfigStruct: BeetStruct<InterestRateConfig, Partial<InterestRateConfig>>;
31
31
  export type BankConfig = {
32
32
  assetWeightInit: WrappedI80F48;
33
33
  assetWeightMaint: WrappedI80F48;
@@ -37,32 +37,39 @@ export type BankConfig = {
37
37
  interestRateConfig: InterestRateConfig;
38
38
  operationalState: BankOperationalState;
39
39
  oracleSetup: OracleSetup;
40
- oracleKeys: PublicKey[];
41
- ignore1: number[];
40
+ oracleKeys_1: PublicKey;
41
+ oracleKeys_2: PublicKey;
42
+ oracleKeys_3: PublicKey;
43
+ oracleKeys_4: PublicKey;
44
+ oracleKeys_5: PublicKey;
45
+ auto_padding_0: number[];
42
46
  borrowLimit: BigNumber;
43
47
  riskTier: RiskTier;
48
+ auto_padding_1: BigNumber[];
49
+ totalAssetValueInitLimit: BigNumber;
44
50
  padding: BigNumber[];
45
51
  };
46
- export declare const bankConfigStruct: FixableBeetStruct<BankConfig, Partial<BankConfig>>;
52
+ export declare const bankConfigStruct: BeetStruct<BankConfig, Partial<BankConfig>>;
47
53
  export type Bank = {
48
54
  padding: Buffer;
49
55
  mint: PublicKey;
50
56
  mintDecimals: number;
51
57
  group: PublicKey;
52
- ignore1: number[];
58
+ auto_padding_0: number[];
53
59
  assetShareValue: WrappedI80F48;
54
60
  liabilityShareValue: WrappedI80F48;
55
61
  liquidityVault: PublicKey;
56
- blob: Buffer;
62
+ liquidityVaultBump: number;
63
+ liquidityVaultAuthorityBump: number;
57
64
  insuranceVault: PublicKey;
58
65
  insuranceVaultBump: number;
59
- insuranceVaultAuthorityBump: PublicKey;
60
- ignore3: PublicKey;
66
+ insuranceVaultAuthorityBump: number;
67
+ auto_padding_1: PublicKey;
61
68
  collectedInsuranceFeesOutstanding: WrappedI80F48;
62
69
  feeVault: PublicKey;
63
70
  feeVaultBump: number;
64
71
  feeVaultAuthorityBump: number;
65
- ignore4: number[];
72
+ auto_padding_2: number[];
66
73
  collectedGroupFeesOutstanding: WrappedI80F48;
67
74
  totalLiabilityShares: WrappedI80F48;
68
75
  totalAssetShares: WrappedI80F48;
@@ -75,4 +82,4 @@ export type Bank = {
75
82
  padding0: BigNumber[];
76
83
  padding1: BigNumber[];
77
84
  };
78
- export declare const bankStruct: FixableBeetStruct<Bank, Partial<Bank>>;
85
+ export declare const bankStruct: BeetStruct<Bank, Partial<Bank>>;