From 7d3b893e85ea9c9e0623509da9e3c3c5165dbd8c Mon Sep 17 00:00:00 2001 From: Akira <156126180+akiraonstarknet@users.noreply.github.com> Date: Fri, 19 Jul 2024 13:58:54 +0530 Subject: [PATCH] add vercel speed analytics (#74) * fix: fix STRK/USDC base apr (#72) * add TVL limit, standarise stats API, fix strategy metadata issue * format code * add vercel speed analytics --------- Co-authored-by: Oche --- package.json | 1 + src/app/strategy/components/Strategy.tsx | 2 +- src/app/template.tsx | 2 +- src/components/Strategies.tsx | 3 +- src/store/nostralending.store.ts | 2 +- src/store/strategies.atoms.ts | 4 +-- src/strategies/delta_neutral_mm.ts | 4 ++- yarn.lock | 46 +++++++++++++++++++----- 8 files changed, 48 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 30afaaf..1d17d9e 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "@types/mixpanel-browser": "2.49.0", "@types/mustache": "4.2.5", "@vercel/analytics": "1.2.2", + "@vercel/speed-insights": "^1.0.12", "axios": "1.6.7", "bignumber.js": "4.0.4", "chroma.ts": "1.0.10", diff --git a/src/app/strategy/components/Strategy.tsx b/src/app/strategy/components/Strategy.tsx index 395440f..7735a93 100644 --- a/src/app/strategy/components/Strategy.tsx +++ b/src/app/strategy/components/Strategy.tsx @@ -268,7 +268,7 @@ const Strategy = () => { Behind the scenes - This is what happens when you invest $1000 in this strategy: + Actions done automatically by the strategy (smart-contract) with an investment of $1000 + > {strat.name} diff --git a/src/store/nostralending.store.ts b/src/store/nostralending.store.ts index 7b4603f..98823e0 100644 --- a/src/store/nostralending.store.ts +++ b/src/store/nostralending.store.ts @@ -63,7 +63,7 @@ const PoolAddresses: { [token: string]: NostraPoolFactor } = { }; export class NostraLending extends IDapp { - name = 'Nostra MM'; + name = 'Nostra Money Markets'; link = 'https://app.nostra.finance/'; logo = 'https://static-assets-8zct.onrender.com/integrations/nostra/logo_dark.jpg'; diff --git a/src/store/strategies.atoms.ts b/src/store/strategies.atoms.ts index e757e10..336390a 100644 --- a/src/store/strategies.atoms.ts +++ b/src/store/strategies.atoms.ts @@ -73,7 +73,7 @@ export function getStrategies() { 'ETH', // ! change this later CONSTANTS.CONTRACTS.DeltaNeutralMMSTRKETH, - [1, 0.384215, 1, 0.233276, 0.233276], // precomputed factors based on strategy math, last is the excess deposit1 that is happening + [1, 0.384215, 1, 0.492308, 0.233276], // precomputed factors based on strategy math, last is the excess deposit1 that is happening StrategyLiveStatus.NEW, { maxTVL: 50000, @@ -97,7 +97,7 @@ export const strategiesAtom = atom((get) => { const strategies = getStrategies(); const allPools = get(allPoolsAtomUnSorted); const filteredPools = allPools.filter( - (p) => p.protocol.name === 'zkLend' || p.protocol.name === 'Nostra MM', + (p) => p.protocol.name === 'zkLend' || p.protocol.name === 'Nostra Money Markets', ); for (const s of strategies) { diff --git a/src/strategies/delta_neutral_mm.ts b/src/strategies/delta_neutral_mm.ts index e920a23..dffbd10 100644 --- a/src/strategies/delta_neutral_mm.ts +++ b/src/strategies/delta_neutral_mm.ts @@ -171,7 +171,7 @@ export class DeltaNeutralMM extends IStrategy { const excessFactor = this.stepAmountFactors[4]; const amount1 = excessFactor * full_amount; const exp1 = amount1 * this.actions[0].pool.apr; - const amount2 = this.stepAmountFactors[1] * excessFactor * full_amount; + const amount2 = this.stepAmountFactors[1] * amount1; const exp2 = amount2 * (this.actions[2].pool.apr - this.actions[1].pool.borrow.apr); const amount3 = this.stepAmountFactors[3] * amount2; @@ -187,6 +187,7 @@ export class DeltaNeutralMM extends IStrategy { }; console.log( 'getLookRepeatYieldAmount exp1', + this.id, exp1, full_amount, exp2, @@ -194,6 +195,7 @@ export class DeltaNeutralMM extends IStrategy { this.actions[2], this.actions[1], exp3, + amount1, amount3, ); return [...actions, strategyAction]; diff --git a/yarn.lock b/yarn.lock index 5e8e0c9..b9d6588 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1971,6 +1971,11 @@ dependencies: server-only "^0.0.1" +"@vercel/speed-insights@^1.0.12": + version "1.0.12" + resolved "https://registry.yarnpkg.com/@vercel/speed-insights/-/speed-insights-1.0.12.tgz#71c2edffdedae98d34e306d7b0a573e6816898b4" + integrity sha512-ZGQ+a7bcfWJD2VYEp2R1LHvRAMyyaFBYytZXsfnbOMkeOvzGNVxUL7aVUvisIrTZjXTSsxG45DKX7yiw6nq2Jw== + "@walletconnect/core@2.13.1": version "2.13.1" resolved "https://registry.npmjs.org/@walletconnect/core/-/core-2.13.1.tgz" @@ -3095,12 +3100,12 @@ electron-to-chromium@^1.4.796: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.808.tgz#85b2f93a5e32c2949a1a4d39375851945c936835" integrity sha512-0ItWyhPYnww2VOuCGF4s1LTfbrdAV2ajy/TN+ZTuhR23AHI6rWHCrBXJ/uxoXOvRRqw8qjYVrG81HFI7x/2wdQ== -embla-carousel-autoplay@^8.1.6: +embla-carousel-autoplay@8.1.6: version "8.1.6" resolved "https://registry.yarnpkg.com/embla-carousel-autoplay/-/embla-carousel-autoplay-8.1.6.tgz#24696cb6037bbb3e894f51a8bcf6698c81ea38cf" integrity sha512-e5n9f4q+DVeBPiPPT3gwzqpiqfae8aP8fQACS4OZkPFvFLdsVhnWcw+cwtewryP7snWJGKPXEMA1GOjieEKv+w== -embla-carousel-react@^8.1.6: +embla-carousel-react@8.1.6: version "8.1.6" resolved "https://registry.yarnpkg.com/embla-carousel-react/-/embla-carousel-react-8.1.6.tgz#4de0cef2888443f4203408df73af2707e5c961e9" integrity sha512-DHxwFzF63yVrU95Eo58E9Xr5b6Y9ul6TTsqb/rtwMi+jXudAmIqN1i9iBxQ73i8jKuUVxll/ziNYMmnWvrdQJQ== @@ -5206,7 +5211,7 @@ prelude-ls@^1.2.1: resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== -prettier@^3.3.3: +prettier@3.3.3: version "3.3.3" resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.3.3.tgz#30c54fe0be0d8d12e6ae61dbb10109ea00d53105" integrity sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew== @@ -5321,7 +5326,7 @@ react-focus-lock@^2.9.4: use-callback-ref "^1.3.0" use-sidecar "^1.1.2" -react-hot-toast@^2.4.1: +react-hot-toast@2.4.1: version "2.4.1" resolved "https://registry.yarnpkg.com/react-hot-toast/-/react-hot-toast-2.4.1.tgz#df04295eda8a7b12c4f968e54a61c8d36f4c0994" integrity sha512-j8z+cQbWIM5LY37pR6uZR6D4LfseplqnuAO4co4u8917hBUvXlEqyP1ZzqVLcqoyUesZZv/ImreoCeHVDpE5pQ== @@ -5644,7 +5649,7 @@ set-function-name@^2.0.0, set-function-name@^2.0.1: functions-have-names "^1.2.3" has-property-descriptors "^1.0.2" -sharp@^0.33.4: +sharp@0.33.4: version "0.33.4" resolved "https://registry.yarnpkg.com/sharp/-/sharp-0.33.4.tgz#b88e6e843e095c6ab5e1a0c59c4885e580cd8405" integrity sha512-7i/dt5kGl7qR4gwPRD2biwD2/SvBn3O04J77XKFgL2OnZtQw+AG9wnuS/csmu80nPRHLYE9E41fyEiG8nhH6/Q== @@ -5828,7 +5833,16 @@ strict-uri-encode@^2.0.0: resolved "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz" integrity sha512-QwiXZgpRcKkhTj2Scnn++4PKtWsH0kpzZ62L2R6c/LUVYv7hVnZqcg2+sMuT6R7Jusu1vviK/MFsu6kNJfWlEQ== -"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -5895,7 +5909,14 @@ string_decoder@^1.1.1: dependencies: safe-buffer "~5.2.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": + version "6.0.1" + resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -6474,7 +6495,16 @@ wordwrap@^1.0.0: resolved "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz" integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": + version "7.0.0" + resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + +wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==