Skip to content

Commit

Permalink
add vercel speed analytics (#74)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
akiraonstarknet and EjembiEmmanuel authored Jul 19, 2024
1 parent c92a1af commit 7d3b893
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 16 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/app/strategy/components/Strategy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ const Strategy = () => {
Behind the scenes
</Text>
<Text fontSize={'15px'} marginBottom={'10px'}>
This is what happens when you invest $1000 in this strategy:
Actions done automatically by the strategy (smart-contract) with an investment of $1000
</Text>
<Flex
color="white"
Expand Down
2 changes: 1 addition & 1 deletion src/app/template.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import * as React from 'react';
import { RpcProviderOptions, constants } from 'starknet';
import { ArgentMobileConnector } from 'starknetkit/argentMobile';
import { InjectedConnector } from 'starknetkit/injected';

import { SpeedInsights } from "@vercel/speed-insights/next"
import Navbar from '@/components/Navbar';
import { Toaster } from 'react-hot-toast';

Expand Down
3 changes: 1 addition & 2 deletions src/components/Strategies.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,9 @@ export default function Strategies() {
marginBottom={'5px'}
fontWeight={'bold'}
alignItems={'center'}
>
>
<Heading
size={{ base: 'sm', md: 'md' }}
marginBottom={'5px'}
fontWeight={'bold'}
>
{strat.name}
Expand Down
2 changes: 1 addition & 1 deletion src/store/nostralending.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const PoolAddresses: { [token: string]: NostraPoolFactor } = {
};

export class NostraLending extends IDapp<LendingSpace.MyBaseAprDoc[]> {
name = 'Nostra MM';
name = 'Nostra Money Markets';
link = 'https://app.nostra.finance/';
logo =
'https://static-assets-8zct.onrender.com/integrations/nostra/logo_dark.jpg';
Expand Down
4 changes: 2 additions & 2 deletions src/store/strategies.atoms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -97,7 +97,7 @@ export const strategiesAtom = atom<StrategyInfo[]>((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) {
Expand Down
4 changes: 3 additions & 1 deletion src/strategies/delta_neutral_mm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -187,13 +187,15 @@ export class DeltaNeutralMM extends IStrategy {
};
console.log(
'getLookRepeatYieldAmount exp1',
this.id,
exp1,
full_amount,
exp2,
amount2,
this.actions[2],
this.actions[1],
exp3,
amount1,
amount3,
);
return [...actions, strategyAction];
Expand Down
46 changes: 38 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]":
version "2.13.1"
resolved "https://registry.npmjs.org/@walletconnect/core/-/core-2.13.1.tgz"
Expand Down Expand Up @@ -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:
[email protected]:
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:
[email protected]:
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==
Expand Down Expand Up @@ -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:
[email protected]:
version "3.3.3"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.3.3.tgz#30c54fe0be0d8d12e6ae61dbb10109ea00d53105"
integrity sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==
Expand Down Expand Up @@ -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:
[email protected]:
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==
Expand Down Expand Up @@ -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:
[email protected]:
version "0.33.4"
resolved "https://registry.yarnpkg.com/sharp/-/sharp-0.33.4.tgz#b88e6e843e095c6ab5e1a0c59c4885e580cd8405"
integrity sha512-7i/dt5kGl7qR4gwPRD2biwD2/SvBn3O04J77XKFgL2OnZtQw+AG9wnuS/csmu80nPRHLYE9E41fyEiG8nhH6/Q==
Expand Down Expand Up @@ -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==
Expand Down Expand Up @@ -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==
Expand Down Expand Up @@ -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==
Expand Down

0 comments on commit 7d3b893

Please sign in to comment.