Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused env vars. update readme. Deploy your own frontend. #3041

Merged
merged 4 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 6 additions & 19 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
# Required
# Covalent (https://www.covalenthq.com/)
VITE_COVALENT_API_KEY=""

# Optional
# Toggle to "true" to use Olympus Give features
VITE_GIVE_ENABLED="true"
# This should be toggled to "true" if you need to use the mock sOHM contract
# (which allows for on-demand rebasing)
VITE_MOCK_SOHM_ENABLED="false"

# Optional
# Google Analytics (https://analytics.google.com/)
VITE_GOOGLE_ANALYTICS_API_KEY=""
# Google Analytics 4 API Key
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need both GA?

VITE_GA_4_API_KEY=""

# Optional
# If you run your own node, you can provide connection url(s) to that node.
Expand All @@ -25,14 +17,6 @@ VITE_FANTOM_TESTNET_NODE_URL=""
VITE_POLYGON_NODE_URL=""
VITE_POLYGON_TESTNET_NODE_URL=""

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need Polygon?

# Olympus Give
# These 2 settings should be toggled to "true" if you want to use Olympus Give features
VITE_GIVE_ENABLED="true"
VITE_GIVE_GRANTS_ENABLED="true"

brightiron marked this conversation as resolved.
Show resolved Hide resolved
# This should be toggled to "true" if you need to use the mock sOHM contract
# (which allows for on-demand rebasing)
VITE_MOCK_SOHM_ENABLED="false"

VITE_ARBITRUM_NODE_URL=""
VITE_ARBITRUM_TESTNET_NODE_URL=""
Expand All @@ -41,4 +25,7 @@ VITE_AVALANCHE_NODE_URL=""
VITE_AVALANCHE_TESTNET_NODE_URL=""

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here. Why do we need this in code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can probably remove these and only support mainnet and arbitrum on the network selector.

# Get a wallet connect project id here: https://cloud.walletconnect.com
VITE_WALLETCONNECT_PROJECT_ID=""
VITE_WALLETCONNECT_PROJECT_ID=""

#Subgraph URL for Protocol Metrics. If not set Protocol Metrics will not be displayed.
VITE_WG_PUBLIC_NODE_URL=""
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,11 @@ If editing the production content, opt to create a new branch and pull request,
## 🗣 Community and Contributions

- [Join our Discord](https://discord.gg/OlympusDAO) and ask how you can get involved with the DAO!



## Deploy Your Own Frontend

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FOlympusDAO%2Folympus-frontend&env=VITE_WALLETCONNECT_PROJECT_ID&envDescription=Please%20see%20.env.example%20for%20all%20other%20optional%20ENV%20variables&envLink=https%3A%2F%2Fgithub.com%2FOlympusDAO%2Folympus-frontend%2Fblob%2Fdevelop%2F.env.example)
[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/OlympusDAO/olympus-frontend)

5 changes: 4 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import StagingNotification from "src/components/StagingNotification";
import { StakeVersionContainer } from "src/components/StakeVersionContainer";
import TopBar from "src/components/TopBar/TopBar";
import { shouldTriggerSafetyCheck } from "src/helpers";
import { Environment } from "src/helpers/environment/Environment/Environment";
import { useGoogleAnalytics } from "src/hooks/useGoogleAnalytics";
import useTheme from "src/hooks/useTheme";
import { chains } from "src/hooks/wagmi";
Expand Down Expand Up @@ -202,6 +203,8 @@ function App() {
if (isSidebarExpanded) handleSidebarClose();
}, [location]);

const protocolMetricsEnabled = Boolean(Environment.getWundergraphNodeUrl());
const defaultRoute = protocolMetricsEnabled ? "/dashboard" : "/my-balances";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just make the default route always be /my-balances?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. just hadn't historically. so didn't wanna break functionality

return (
<StyledDiv>
<RainbowKitProvider
Expand Down Expand Up @@ -231,7 +234,7 @@ function App() {
<Suspense fallback={<div></div>}>
<Routes>
<Route path="my-balances" element={<MyBalances />} />
<Route path="/" element={<Navigate to="/dashboard" />} />
<Route path="/" element={<Navigate to={defaultRoute} />} />
<Route
path="/stake"
element={<StakeVersionContainer setMigrationModalOpen={setMigrationModalOpen} />}
Expand Down
4 changes: 3 additions & 1 deletion src/components/Sidebar/NavContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ReactComponent as lendAndBorrowIcon } from "src/assets/icons/lendAndBor
import { ReactComponent as OlympusIcon } from "src/assets/icons/olympus-nav-header.svg";
import NavItem from "src/components/library/NavItem";
import { DecimalBigNumber } from "src/helpers/DecimalBigNumber/DecimalBigNumber";
import { Environment } from "src/helpers/environment/Environment/Environment";
import { useTestableNetworks } from "src/hooks/useTestableNetworks";
import { BondDiscount } from "src/views/Bond/components/BondDiscount";
import { DetermineRangeDiscount } from "src/views/Range/hooks";
Expand All @@ -29,6 +30,7 @@ const NavContent: React.VFC = () => {
const { chain = { id: 1 } } = useNetwork();
const networks = useTestableNetworks();

const protocolMetricsEnabled = Boolean(Environment.getWundergraphNodeUrl());
return (
<Paper className="dapp-sidebar">
<Box className="dapp-sidebar-inner" display="flex" justifyContent="space-between" flexDirection="column">
Expand All @@ -50,7 +52,7 @@ const NavContent: React.VFC = () => {
<div className="dapp-menu-links">
<div className="dapp-nav" id="navbarNav">
<NavItem to="/my-balances" icon="stake" label={`My Balances`} />
<NavItem to="/dashboard" icon="dashboard" label={`Protocol Metrics`} />
{protocolMetricsEnabled && <NavItem to="/dashboard" icon="dashboard" label={`Protocol Metrics`} />}
{chain.id === networks.MAINNET ? (
<>
<NavItem
Expand Down
44 changes: 0 additions & 44 deletions src/helpers/environment/Environment/Environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,6 @@ export class Environment {
err: "Please provide an Google Analytics 4 API key in your .env file",
});

public static getCovalentApiKey = () =>
this._get({
first: true,
key: "VITE_COVALENT_API_KEY",
err: "Please provide an API key for Covalent (https://www.covalenthq.com) in your .env file",
});

public static getZapperApiKey = () =>
this._get({
first: true,
key: "VITE_ZAPPER_API",
// NOTE: default Zapper API key. Won't work in production with any real volume of usage.
fallback: "96e0cc51-a62e-42ca-acee-910ea7d2a241",
});

public static getWundergraphNodeUrl = (): string | undefined =>
this._get({
first: true,
Expand All @@ -69,31 +54,6 @@ export class Environment {
fallback: "false",
});

public static getArchiveNodeUrl = (networkId: number) => {
switch (networkId) {
case NetworkId.MAINNET:
return this._get({
key: `VITE_ETHEREUM_ARCHIVE_NODE_URL`,
err: "Please provide a VITE_ETHEREUM_ARCHIVE_NODE_URL for governance to function properly",
});
case NetworkId.TESTNET_GOERLI:
return this._get({
key: `VITE_ETHEREUM_TESTNET_ARCHIVE_NODE_URL`,
err: "Please provide a VITE_ETHEREUM_TESTNET_ARCHIVE_NODE_URL for governance to function properly",
});
case NetworkId.ARBITRUM_GOERLI:
return this._get({
key: `VITE_ARBITRUM_GOERLI_ARCHIVE_NODE_URL`,
err: "Please provide a VITE_ARBITRUM_GOERLI_ARCHIVE_NODE_URL for governance to function properly",
});
case NetworkId.ARBITRUM:
return this._get({
key: `VITE_ARBITRUM_ARCHIVE_NODE_URL`,
err: "Please provide a VITE_ARBITRUM_ARCHIVE_NODE_URL for governance to function properly",
});
}
};

public static getNodeUrls = (networkId: NetworkId) => {
switch (networkId) {
case NetworkId.MAINNET:
Expand Down Expand Up @@ -168,8 +128,4 @@ export class Environment {
});
}
};

public static isWalletNewsEnabled() {
return this.env.VITE_DISABLE_NEWS !== "true";
}
}
34 changes: 0 additions & 34 deletions src/helpers/environment/Environment/Environment.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,30 +44,6 @@ describe("Environment", () => {
});
});

describe("Covalent", () => {
it("should return a Covalent API key", () => {
import.meta.env.VITE_COVALENT_API_KEY = "ckey_442d47723592868l8764adf15bf";
expect(Environment.getCovalentApiKey()).toEqual("ckey_442d47723592868l8764adf15bf");
});

it("should return a Warning when Covalent API key is not present", () => {
expect(Environment.getCovalentApiKey()).toBeUndefined();
// assert the expected warning
expect(console.warn).toHaveBeenCalledWith(
expect.stringContaining(
"Please provide an API key for Covalent (https://www.covalenthq.com) in your .env file",
),
);
});
});

describe("Zapper", () => {
it("should return a Zapper API key", () => {
import.meta.env.VITE_ZAPPER_API = "somekey";
expect(Environment.getZapperApiKey()).toEqual("somekey");
});
});

describe("StagingEnv", () => {
it("should return a StagingEnv", () => {
import.meta.env.VITE_STAGING_ENV = "false";
Expand All @@ -78,16 +54,6 @@ describe("Environment", () => {
});
});

describe("WalletNewsDisabled", () => {
it("should return WalletNewsDisabled", () => {
import.meta.env.VITE_DISABLE_NEWS = "true";
expect(Environment.isWalletNewsEnabled()).toEqual(false);

import.meta.env.VITE_DISABLE_NEWS = "false";
expect(Environment.isWalletNewsEnabled()).toEqual(true);
});
});

describe("Node URLs", () => {
it("should return appropriate NodeURLs by default", () => {
expect(Environment.getNodeUrls(NetworkId.MAINNET)).not.toBeUndefined();
Expand Down
17 changes: 0 additions & 17 deletions src/hooks/useArchiveNodeProvider.ts

This file was deleted.

109 changes: 0 additions & 109 deletions src/hooks/useZapTokenBalances.ts

This file was deleted.

3 changes: 1 addition & 2 deletions src/hooks/useZeroExSwap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { DAO_TREASURY_ADDRESSES, GOHM_ADDRESSES } from "src/constants/addresses"
import { SOHM_ADDRESSES } from "src/constants/addresses";
import { trackGAEvent } from "src/helpers/analytics/trackGAEvent";
import { balanceQueryKey } from "src/hooks/useBalance";
import { zapTokenBalancesKey } from "src/hooks/useZapTokenBalances";
import { EthersError } from "src/lib/EthersTypes";
import { useAccount, useSigner } from "wagmi";

Expand Down Expand Up @@ -41,7 +40,7 @@ export const useZeroExSwap = () => {
const client = useQueryClient();
const { data: signer } = useSigner();
const { address = "" } = useAccount();

const zapTokenBalancesKey = (address: string) => ["zapTokenBalances", address];
return useMutation<ContractReceipt, EthersError, ZapExecuteOptions>(
/**
* Ideally the parameters to this async function should be the slippage, etc.
Expand Down
Loading
Loading