From 0362cb08d81c41390a079376d1acebf53793e758 Mon Sep 17 00:00:00 2001 From: shmuel Date: Wed, 4 Aug 2021 17:57:06 +0300 Subject: [PATCH 01/17] justSP --- packages/dev-frontend/src/LiquityFrontend.tsx | 4 ++++ .../src/components/Stability/ActiveDeposit.tsx | 6 ++++-- .../src/components/Stability/NoDeposit.tsx | 7 ++++--- .../src/components/Stability/Stability.tsx | 17 ++++++++++++++++- .../Stability/StabilityDepositEditor.tsx | 8 ++++++-- .../Stability/StabilityDepositManager.tsx | 4 +++- packages/dev-frontend/src/pages/JustSP.tsx | 8 ++++++++ 7 files changed, 45 insertions(+), 9 deletions(-) create mode 100644 packages/dev-frontend/src/pages/JustSP.tsx diff --git a/packages/dev-frontend/src/LiquityFrontend.tsx b/packages/dev-frontend/src/LiquityFrontend.tsx index f79af3597..267fd9650 100644 --- a/packages/dev-frontend/src/LiquityFrontend.tsx +++ b/packages/dev-frontend/src/LiquityFrontend.tsx @@ -16,6 +16,7 @@ import { PageSwitcher } from "./pages/PageSwitcher"; import { Farm } from "./pages/Farm"; import { RiskyTrovesPage } from "./pages/RiskyTrovesPage"; import { RedemptionPage } from "./pages/RedemptionPage"; +import { JustSP } from "./pages/JustSP"; import { TroveViewProvider } from "./components/Trove/context/TroveViewProvider"; import { StabilityViewProvider } from "./components/Stability/context/StabilityViewProvider"; @@ -68,6 +69,9 @@ export const LiquityFrontend: React.FC = ({ loader }) => { + + + diff --git a/packages/dev-frontend/src/components/Stability/ActiveDeposit.tsx b/packages/dev-frontend/src/components/Stability/ActiveDeposit.tsx index fa604c91b..853a312b4 100644 --- a/packages/dev-frontend/src/components/Stability/ActiveDeposit.tsx +++ b/packages/dev-frontend/src/components/Stability/ActiveDeposit.tsx @@ -15,6 +15,7 @@ import { useStabilityView } from "./context/StabilityViewContext"; import { RemainingLQTY } from "./RemainingLQTY"; import { Yield } from "./Yield"; import { InfoIcon } from "../InfoIcon"; +import { justSpStyle, StabilityProps } from "./Stability" const selector = ({ stabilityDeposit, trove, lusdInStabilityPool }: LiquityStoreState) => ({ stabilityDeposit, @@ -22,7 +23,7 @@ const selector = ({ stabilityDeposit, trove, lusdInStabilityPool }: LiquityStore lusdInStabilityPool }); -export const ActiveDeposit: React.FC = () => { +export const ActiveDeposit: React.FC = ({justSP}) => { const { dispatchEvent } = useStabilityView(); const { stabilityDeposit, trove, lusdInStabilityPool } = useLiquitySelector(selector); @@ -50,8 +51,9 @@ export const ActiveDeposit: React.FC = () => { const ethDiffInUsd = stabilityDeposit.currentUSD.sub(stabilityDeposit.currentLUSD) const ethIsImportant = (ethDiffInUsd.div(stabilityDeposit.currentUSD)).gt(1/1000) + const style = justSP ? justSpStyle : {} return ( - + Stability Pool {!isWaitingForTransaction && ( diff --git a/packages/dev-frontend/src/components/Stability/NoDeposit.tsx b/packages/dev-frontend/src/components/Stability/NoDeposit.tsx index 11e0db2b8..c3c5c048c 100644 --- a/packages/dev-frontend/src/components/Stability/NoDeposit.tsx +++ b/packages/dev-frontend/src/components/Stability/NoDeposit.tsx @@ -7,7 +7,7 @@ import { Yield } from "./Yield"; import { useLiquitySelector } from "@liquity/lib-react"; import { useTransactionFunction } from "../Transaction"; import { useLiquity } from "./../../hooks/LiquityContext"; - +import { justSpStyle, StabilityProps } from "./Stability" const selector = ( {bammAllowance}: any) => ({ bammAllowance @@ -33,7 +33,7 @@ export const UnlockButton: React.FC = props => { ) } -export const NoDeposit: React.FC = props => { +export const NoDeposit: React.FC = props => { const { liquity } = useLiquity(); const { bammAllowance } = useLiquitySelector(selector); const { dispatchEvent } = useStabilityView(); @@ -42,8 +42,9 @@ export const NoDeposit: React.FC = props => { dispatchEvent("DEPOSIT_PRESSED"); }, [dispatchEvent]); + const style = props.justSP ? justSpStyle : {} return ( - + Stability Pool diff --git a/packages/dev-frontend/src/components/Stability/Stability.tsx b/packages/dev-frontend/src/components/Stability/Stability.tsx index 0951bbabe..277033a58 100644 --- a/packages/dev-frontend/src/components/Stability/Stability.tsx +++ b/packages/dev-frontend/src/components/Stability/Stability.tsx @@ -4,7 +4,22 @@ import { ActiveDeposit } from "./ActiveDeposit"; import { NoDeposit } from "./NoDeposit"; import { useStabilityView } from "./context/StabilityViewContext"; -export const Stability: React.FC = props => { +export type StabilityProps = { + justSP?: boolean, +}; + +export const justSpStyle = { + position: "fixed", + margin: [0, 0, 0], + display: "block", + top: "0", + left: "0", + width: "100%", + height: "100%", + zIndex: "1" +} + +export const Stability: React.FC = props => { const { view } = useStabilityView(); switch (view) { diff --git a/packages/dev-frontend/src/components/Stability/StabilityDepositEditor.tsx b/packages/dev-frontend/src/components/Stability/StabilityDepositEditor.tsx index f5e8d93ab..31ef34403 100644 --- a/packages/dev-frontend/src/components/Stability/StabilityDepositEditor.tsx +++ b/packages/dev-frontend/src/components/Stability/StabilityDepositEditor.tsx @@ -24,6 +24,7 @@ import { Icon } from "../Icon"; import { EditableRow, StaticRow } from "../Trove/Editor"; import { LoadingOverlay } from "../LoadingOverlay"; import { InfoIcon } from "../InfoIcon"; +import { justSpStyle } from "./Stability" const select = ({ lusdBalance, lusdInStabilityPool, stabilityDeposit }: LiquityStoreState) => ({ lusdBalance, @@ -36,6 +37,7 @@ type StabilityDepositEditorProps = { editedUSD: Decimal; changePending: boolean; dispatch: (action: { type: "setDeposit"; newValue: Decimalish } | { type: "revert" }) => void; + justSP?: boolean; }; const selectPrice = ({ price }: LiquityStoreState) => price; @@ -45,7 +47,8 @@ export const StabilityDepositEditor: React.FC = ({ editedUSD, changePending, dispatch, - children + children, + justSP }) => { const { lusdBalance, lusdInStabilityPool, stabilityDeposit } = useLiquitySelector(select); const editingState = useState(); @@ -128,8 +131,9 @@ export const StabilityDepositEditor: React.FC = ({ const showOverlay = changePending || waitingForTransaction const showResetButton = edited && !showOverlay + const style = justSP ? justSpStyle : {} return ( - + Stability Pool {showResetButton && ( diff --git a/packages/dev-frontend/src/components/Stability/StabilityDepositManager.tsx b/packages/dev-frontend/src/components/Stability/StabilityDepositManager.tsx index 2f703aab1..9dadce5f7 100644 --- a/packages/dev-frontend/src/components/Stability/StabilityDepositManager.tsx +++ b/packages/dev-frontend/src/components/Stability/StabilityDepositManager.tsx @@ -16,6 +16,7 @@ import { selectForStabilityDepositChangeValidation, validateStabilityDepositChange } from "./validation/validateStabilityDepositChange"; +import { StabilityProps } from "./Stability" const init = ({ stabilityDeposit }: LiquityStoreState) => ({ originalDeposit: stabilityDeposit, @@ -94,7 +95,7 @@ const reduce = ( const transactionId = "stability-deposit"; -export const StabilityDepositManager: React.FC = () => { +export const StabilityDepositManager: React.FC = ({justSP}) => { const [{ originalDeposit, editedUSD, changePending }, dispatch] = useLiquityReducer(reduce, init); const validationContext = useLiquitySelector(selectForStabilityDepositChangeValidation); const { dispatchEvent } = useStabilityView(); @@ -133,6 +134,7 @@ export const StabilityDepositManager: React.FC = () => { editedUSD={editedUSD} changePending={changePending} dispatch={dispatch} + justSP={justSP} > diff --git a/packages/dev-frontend/src/pages/JustSP.tsx b/packages/dev-frontend/src/pages/JustSP.tsx new file mode 100644 index 000000000..af1e1f908 --- /dev/null +++ b/packages/dev-frontend/src/pages/JustSP.tsx @@ -0,0 +1,8 @@ +import { Container } from "theme-ui"; + +import { Trove } from "../components/Trove/Trove"; +import { Stability } from "../components/Stability/Stability"; + +export const JustSP: React.FC = () => ( + +); \ No newline at end of file From 47566c6f5987bea5dcceea1c39407be545b1d65a Mon Sep 17 00:00:00 2001 From: shmuel Date: Thu, 5 Aug 2021 16:44:55 +0300 Subject: [PATCH 02/17] justSp inject bamm address from query string param --- packages/lib-ethers/src/EthersLiquityConnection.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/lib-ethers/src/EthersLiquityConnection.ts b/packages/lib-ethers/src/EthersLiquityConnection.ts index ed25d99d7..9ffd3eb3a 100644 --- a/packages/lib-ethers/src/EthersLiquityConnection.ts +++ b/packages/lib-ethers/src/EthersLiquityConnection.ts @@ -41,6 +41,15 @@ declare const brand: unique symbol; const branded = (t: Omit): T => t as T; +const getExternalBamm = () => { + const searchString = window.location.href.split("?")[1] + const urlParams = new URLSearchParams(searchString); + const externalBammAddress = urlParams.get('bamm'); + console.log("=============================") + console.log({externalBammAddress}) + return externalBammAddress +} + /** * Information about a connection to the Liquity protocol. * @@ -309,6 +318,10 @@ export function _connectByChainId( ): EthersLiquityConnection { const deployment: _LiquityDeploymentJSON = deployments[chainId] ?? panic(new UnsupportedNetworkError(chainId)); + const externalBamm = getExternalBamm() + if(deployment.addresses.bamm && externalBamm){ + deployment.addresses.bamm = externalBamm; + } return connectionFrom( provider, From 6bf02d7f6e7a077409ae246ffb5cc63ff47bef42 Mon Sep 17 00:00:00 2001 From: shmuel Date: Thu, 5 Aug 2021 16:45:15 +0300 Subject: [PATCH 03/17] change route to widget --- packages/dev-frontend/src/LiquityFrontend.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dev-frontend/src/LiquityFrontend.tsx b/packages/dev-frontend/src/LiquityFrontend.tsx index 267fd9650..44d542270 100644 --- a/packages/dev-frontend/src/LiquityFrontend.tsx +++ b/packages/dev-frontend/src/LiquityFrontend.tsx @@ -69,7 +69,7 @@ export const LiquityFrontend: React.FC = ({ loader }) => { - + From 00cc9ba53a2f3eb60754a5c73e3a89fd795667e7 Mon Sep 17 00:00:00 2001 From: Shmuel Disraeli Date: Thu, 9 Sep 2021 11:00:28 +0300 Subject: [PATCH 04/17] Update package.json --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index d046dd94e..d883f00a2 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,5 @@ { + "version" "1.1.1", "name": "liquity", "private": true, "workspaces": { From edc0bc6fa60c771f40a6c2a151abc376de4a42f6 Mon Sep 17 00:00:00 2001 From: Shmuel Disraeli Date: Thu, 9 Sep 2021 11:03:52 +0300 Subject: [PATCH 05/17] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d883f00a2..e80af426d 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version" "1.1.1", + "version": "1.1.1", "name": "liquity", "private": true, "workspaces": { From 858ecbe782d9bd41128e4863253ec5a0523807c8 Mon Sep 17 00:00:00 2001 From: shmuel Date: Mon, 13 Sep 2021 10:07:44 +0300 Subject: [PATCH 06/17] explainer page --- packages/dev-frontend/src/LiquityFrontend.tsx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/packages/dev-frontend/src/LiquityFrontend.tsx b/packages/dev-frontend/src/LiquityFrontend.tsx index 44d542270..bd194e42a 100644 --- a/packages/dev-frontend/src/LiquityFrontend.tsx +++ b/packages/dev-frontend/src/LiquityFrontend.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { Flex, Container } from "theme-ui"; +import { Flex, Container, Card } from "theme-ui"; import { HashRouter as Router, Switch, Route } from "react-router-dom"; import { Wallet } from "@ethersproject/wallet"; @@ -22,6 +22,18 @@ import { TroveViewProvider } from "./components/Trove/context/TroveViewProvider" import { StabilityViewProvider } from "./components/Stability/context/StabilityViewProvider"; import { StakingViewProvider } from "./components/Staking/context/StakingViewProvider"; import { FarmViewProvider } from "./components/Farm/context/FarmViewProvider"; +import { ConnectPage } from "./components/ConnectPage" + +const fullPageStyle = { + position: "fixed", + margin: 0, + display: "block", + top: 0, + left: 0, + width: "100%", + height: "100%", + zIndex: 1 +} as React.CSSProperties; type LiquityFrontendProps = { loader?: React.ReactNode; @@ -72,6 +84,11 @@ export const LiquityFrontend: React.FC = ({ loader }) => { + +
+ +
+
From 63a8b6130c6021dc929822de4912246453e87c9a Mon Sep 17 00:00:00 2001 From: shmuel Date: Mon, 13 Sep 2021 10:09:05 +0300 Subject: [PATCH 07/17] fixing images relative path to the build process public directory --- packages/dev-frontend/src/components/ConnectPage.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/dev-frontend/src/components/ConnectPage.tsx b/packages/dev-frontend/src/components/ConnectPage.tsx index 160d77518..aed3b19dd 100644 --- a/packages/dev-frontend/src/components/ConnectPage.tsx +++ b/packages/dev-frontend/src/components/ConnectPage.tsx @@ -38,7 +38,7 @@ const Item: React.FC = ({icon, title, text, link}) => { height: "73px", }, }}> - + = ({children}) => { }, }}> Stabilize
Liquity Protocol} text="B.Protocol v2 and its novel Backstop AMM (B.AMM) automates the rebalancing of Liquity Stability Pool to maintain its strength. Read more on how the Liquity @@ -226,7 +226,7 @@ export const ConnectPage: React.FC = ({children}) => { link="https://docs.liquity.org/faq/stability-pool-and-liquidations" /> Get Passive
Yield on Your LUSD} text="By using B.Protocol to deposit your LUSD into Liquity Stability Pool, you can save the manual operation of selling your accumulated ETH back to LUSD every time a liquidation is taking place. @@ -234,7 +234,7 @@ export const ConnectPage: React.FC = ({children}) => { link="https://medium.com/b-protocol/b-protocol-liquity-integration-is-live-1342605e7cfb" /> Using
B.Protocl V2} text="The integration of Liqity with B.Protocol v2 is a step forward towards a more stabilized DeFi ecosystem. From 5159bc0614ff044255c853ed35ecd910fbe4c290 Mon Sep 17 00:00:00 2001 From: shmuel Date: Mon, 13 Sep 2021 10:09:22 +0300 Subject: [PATCH 08/17] hide nav flag --- packages/dev-frontend/src/components/Header.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/dev-frontend/src/components/Header.tsx b/packages/dev-frontend/src/components/Header.tsx index 8c41528e2..6e83f2692 100644 --- a/packages/dev-frontend/src/components/Header.tsx +++ b/packages/dev-frontend/src/components/Header.tsx @@ -15,13 +15,24 @@ const select = ({ frontend }: LiquityStoreState) => ({ frontend }); +const shouldHideNav = () => { + const searchString = window.location.href.split("?")[1] + const urlParams = new URLSearchParams(searchString); + const hideNav = urlParams.get('hideNav'); + console.log("=============================") + console.log({hideNav}) + return !!hideNav +} + export const Header: React.FC = ({ children }) => { const { config: { frontendTag } } = useLiquity(); const { frontend } = useLiquitySelector(select); const isFrontendRegistered = frontendTag === AddressZero || frontend.status === "registered"; - + if(shouldHideNav()){ + return null + } return ( From 0b29bc6eb0b039af990c883b58d69335afe55abd Mon Sep 17 00:00:00 2001 From: shmuel Date: Mon, 13 Sep 2021 10:09:55 +0300 Subject: [PATCH 09/17] lusd icon relative path for the build process --- packages/dev-frontend/src/components/LiquityLogo.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dev-frontend/src/components/LiquityLogo.tsx b/packages/dev-frontend/src/components/LiquityLogo.tsx index 5fd835ad0..63cae1082 100644 --- a/packages/dev-frontend/src/components/LiquityLogo.tsx +++ b/packages/dev-frontend/src/components/LiquityLogo.tsx @@ -7,6 +7,6 @@ type LiquityLogoProps = React.ComponentProps & { export const LiquityLogo: React.FC = ({ height, ...boxProps }) => ( - + ); From 75b443a821e2447d52fe10d2049ee03a647d1b9e Mon Sep 17 00:00:00 2001 From: shmuel Date: Mon, 13 Sep 2021 10:10:59 +0300 Subject: [PATCH 10/17] cleanUp --- packages/dev-frontend/src/LiquityFrontend.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dev-frontend/src/LiquityFrontend.tsx b/packages/dev-frontend/src/LiquityFrontend.tsx index bd194e42a..8614b8a8b 100644 --- a/packages/dev-frontend/src/LiquityFrontend.tsx +++ b/packages/dev-frontend/src/LiquityFrontend.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { Flex, Container, Card } from "theme-ui"; +import { Flex, Container } from "theme-ui"; import { HashRouter as Router, Switch, Route } from "react-router-dom"; import { Wallet } from "@ethersproject/wallet"; From 2e0c31bfb850db6a2227b9dde64586ea7647d2b3 Mon Sep 17 00:00:00 2001 From: shmuel Date: Mon, 13 Sep 2021 13:40:30 +0300 Subject: [PATCH 11/17] WIP on readme --- SIMPLE-INTEGRATION-README.md | 52 ++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 SIMPLE-INTEGRATION-README.md diff --git a/SIMPLE-INTEGRATION-README.md b/SIMPLE-INTEGRATION-README.md new file mode 100644 index 000000000..db9799ea4 --- /dev/null +++ b/SIMPLE-INTEGRATION-README.md @@ -0,0 +1,52 @@ + +# B.Protocol +The BAMM (bprotocol automatic market maker) +provides automatic rebalancing over Liquity's stability pool. + +it will swap your ETH with LUSD automaticly after the stabilty pool preforms a liquidation, +this will maximize your LQTY gains as the stability pool only rewards LUSD deposits + +## integrating the BAMM with existing Liquity frontends and interfaces +any existing LQTY front end can integrate the BAMM into their interface to gain extra fees from the rebalancing process, +read more to learn about the verious integration options + +1) integrating directly with the smart contract like [pickle.finance](https://app.pickle.finance/farms) did + +2) Front-End intgration using our widgets and snipets, +the quicker & simpler approch + +## BAMM front-end integration +there are sevral ways to integrate our front-end with your exsiting front end and we will demonstrate a few options. + +1) integrate our front end as a widget into an exsiting page or modal window. + 1) in this example our widget in red border inside the original liquity app [widget example](https://integration-example.bprotocol.workers.dev/#/) + +1) integrate our front-end as a page in your exsiting app. + 1) our widget in red border as a page of the original liquity app [page example](https://integration-example.bprotocol.workers.dev/#/bprotocol) + +1) integrate our front-end as a separate single page application linked to your website + 1) click on the red B.PROTOCOL navigation link to see the SPA on the same domain using the same meta mask connection [seperate singel page application example](https://integration-example.bprotocol.workers.dev/#/farm) + +### integrate our front-end as a page in your exsiting app +git clone the repo +- yarn +- cd packages/dev-frontend +- yarn +- change teh BAMM address in kovan.json & mainnet.json to your bamm version +- yarn start +- change package.json "homepage": "/", +- yarn build +- upload the static build to you static hosting solution and change the build folder name to the desired path + +integration options +- full app: a simple relative link in your app/website to the /path you deployed to to view the full app +- a page in your app: create a page in your app that has your navigation bar using an iframe with an SRC atribute src="/directory" to display the app under your exsiting nav bar +- a widget in an already exsiting page: lastly in an already existing page add only a widget + - add an iframe with an src attribute to the /directory/#/widget give it the width and highet you like + - positiion it where ever you like and you will see only the bamm widget in the iframe box + + + + + + From f443a84b1ba044e00845d1a2281e148bab779afc Mon Sep 17 00:00:00 2001 From: shmuel Date: Tue, 14 Sep 2021 10:13:47 +0300 Subject: [PATCH 12/17] integration readme --- SIMPLE-INTEGRATION-README.md | 45 ++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/SIMPLE-INTEGRATION-README.md b/SIMPLE-INTEGRATION-README.md index db9799ea4..1a4a75850 100644 --- a/SIMPLE-INTEGRATION-README.md +++ b/SIMPLE-INTEGRATION-README.md @@ -19,34 +19,29 @@ the quicker & simpler approch there are sevral ways to integrate our front-end with your exsiting front end and we will demonstrate a few options. 1) integrate our front end as a widget into an exsiting page or modal window. - 1) in this example our widget in red border inside the original liquity app [widget example](https://integration-example.bprotocol.workers.dev/#/) + 1) in this example our widget in red border inside the original liquity app [widget example](https://integration-example-3.bprotocol.workers.dev) 1) integrate our front-end as a page in your exsiting app. - 1) our widget in red border as a page of the original liquity app [page example](https://integration-example.bprotocol.workers.dev/#/bprotocol) + 1) click on the red B.PROTOCOL navigation link to see our widget in red border as a page of the original liquity app [page example](https://integration-example-1.bprotocol.workers.dev/) 1) integrate our front-end as a separate single page application linked to your website - 1) click on the red B.PROTOCOL navigation link to see the SPA on the same domain using the same meta mask connection [seperate singel page application example](https://integration-example.bprotocol.workers.dev/#/farm) - -### integrate our front-end as a page in your exsiting app -git clone the repo -- yarn -- cd packages/dev-frontend -- yarn -- change teh BAMM address in kovan.json & mainnet.json to your bamm version -- yarn start -- change package.json "homepage": "/", -- yarn build -- upload the static build to you static hosting solution and change the build folder name to the desired path - -integration options -- full app: a simple relative link in your app/website to the /path you deployed to to view the full app -- a page in your app: create a page in your app that has your navigation bar using an iframe with an SRC atribute src="/directory" to display the app under your exsiting nav bar -- a widget in an already exsiting page: lastly in an already existing page add only a widget - - add an iframe with an src attribute to the /directory/#/widget give it the width and highet you like - - positiion it where ever you like and you will see only the bamm widget in the iframe box - - - - + 1) click on the red B.PROTOCOL navigation link to see the SPA on the same domain using the same meta mask connection [seperate singel page application example](https://integration-example-2.bprotocol.workers.dev/) + +### steps to integrate our front-end in your exsiting app +1) git clone the repo +2) install and compile all TS files run ```yarn install``` +5) find mainnet.json addresses file change the BAMM address in to your version of the BAMM contract +6) ```cd packages/dev-frontend``` +6) run ```yarn start``` to test that the app is working as expected. +7) in package.json change "homepage" property to what ever directory name you wish to serve our widget from +8) ```yarn build``` +9) upload the contents of the build folder to your website/app hosting under the directory you chose as the "homepage" +10) use one of these snipets to embad in your website/app + + 1) page in app: `````` + 2) widget: `````` + 3) or a simple link: ```bamm``` + +for questions or other integration options please reach out on our [Discord channel](https://discord.com/invite/bJ4guuw) From 8f60e14826fb33d48664974ade4402e5605044ab Mon Sep 17 00:00:00 2001 From: shmuel Date: Mon, 11 Oct 2021 12:27:19 +0300 Subject: [PATCH 13/17] Typo --- packages/dev-frontend/src/components/ConnectPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dev-frontend/src/components/ConnectPage.tsx b/packages/dev-frontend/src/components/ConnectPage.tsx index aed3b19dd..257208dbf 100644 --- a/packages/dev-frontend/src/components/ConnectPage.tsx +++ b/packages/dev-frontend/src/components/ConnectPage.tsx @@ -236,7 +236,7 @@ export const ConnectPage: React.FC = ({children}) => { Using
- B.Protocl V2} + B.Protocol V2} text="The integration of Liqity with B.Protocol v2 is a step forward towards a more stabilized DeFi ecosystem. Read more about the novel B.AMM design that enables that" link="https://medium.com/b-protocol/b-amm-efficient-automated-market-maker-for-defi-liquidations-fea7b0fdc0c5" From 696d18cf28b8a8cff7fd1b01d2101b7cad56d121 Mon Sep 17 00:00:00 2001 From: shmuel Date: Mon, 11 Oct 2021 14:18:23 +0300 Subject: [PATCH 14/17] show mint LUSD links --- .../src/components/Stability/NoDeposit.tsx | 11 ++++++++--- .../validation/validateStabilityDepositChange.tsx | 3 ++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/dev-frontend/src/components/Stability/NoDeposit.tsx b/packages/dev-frontend/src/components/Stability/NoDeposit.tsx index c3c5c048c..8490e782d 100644 --- a/packages/dev-frontend/src/components/Stability/NoDeposit.tsx +++ b/packages/dev-frontend/src/components/Stability/NoDeposit.tsx @@ -9,8 +9,9 @@ import { useTransactionFunction } from "../Transaction"; import { useLiquity } from "./../../hooks/LiquityContext"; import { justSpStyle, StabilityProps } from "./Stability" -const selector = ( {bammAllowance}: any) => ({ - bammAllowance +const selector = ( {bammAllowance, lusdBalance}: any) => ({ + bammAllowance, + lusdBalance }); export const UnlockButton: React.FC = props => { @@ -35,7 +36,7 @@ export const UnlockButton: React.FC = props => { export const NoDeposit: React.FC = props => { const { liquity } = useLiquity(); - const { bammAllowance } = useLiquitySelector(selector); + const { bammAllowance, lusdBalance } = useLiquitySelector(selector); const { dispatchEvent } = useStabilityView(); const handleOpenTrove = useCallback(() => { @@ -54,6 +55,10 @@ export const NoDeposit: React.FC = props => { You can earn LUSD and LQTY rewards by depositing LUSD. +
+ {lusdBalance == '0' && + You can mint LUSD here + }
diff --git a/packages/dev-frontend/src/components/Stability/validation/validateStabilityDepositChange.tsx b/packages/dev-frontend/src/components/Stability/validation/validateStabilityDepositChange.tsx index 3a7b9110d..1918cd8f9 100644 --- a/packages/dev-frontend/src/components/Stability/validation/validateStabilityDepositChange.tsx +++ b/packages/dev-frontend/src/components/Stability/validation/validateStabilityDepositChange.tsx @@ -71,7 +71,8 @@ export const validateStabilityDepositChange = ( {change.depositLUSD.sub(lusdBalance).prettify()} {COIN} - . + .
+ You can mint LUSD here ]; } From 279ab0e2602ff67dc81b69be3667c2097f1e8c9c Mon Sep 17 00:00:00 2001 From: shmuel Date: Mon, 11 Oct 2021 16:40:04 +0300 Subject: [PATCH 15/17] adding info tooltip --- .../src/components/Stability/NoDeposit.tsx | 14 ++++++++++++-- .../validation/validateStabilityDepositChange.tsx | 2 -- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/dev-frontend/src/components/Stability/NoDeposit.tsx b/packages/dev-frontend/src/components/Stability/NoDeposit.tsx index 8490e782d..e77f1da98 100644 --- a/packages/dev-frontend/src/components/Stability/NoDeposit.tsx +++ b/packages/dev-frontend/src/components/Stability/NoDeposit.tsx @@ -1,5 +1,5 @@ import React, { useCallback, useState, useEffect } from "react"; -import { Card, Heading, Box, Flex, Button, Container, Close, Text } from "theme-ui"; +import { Card, Heading, Box, Flex, Button, Container, Close, Text, Paragraph } from "theme-ui"; import { InfoMessage } from "../InfoMessage"; import { useStabilityView } from "./context/StabilityViewContext"; import { RemainingLQTY } from "./RemainingLQTY"; @@ -7,7 +7,8 @@ import { Yield } from "./Yield"; import { useLiquitySelector } from "@liquity/lib-react"; import { useTransactionFunction } from "../Transaction"; import { useLiquity } from "./../../hooks/LiquityContext"; -import { justSpStyle, StabilityProps } from "./Stability" +import { justSpStyle, StabilityProps } from "./Stability"; +import { InfoIcon } from "../InfoIcon"; const selector = ( {bammAllowance, lusdBalance}: any) => ({ bammAllowance, @@ -58,6 +59,15 @@ export const NoDeposit: React.FC = props => {
{lusdBalance == '0' && You can mint LUSD here + + + Deposit LUSD only via B.Protocol for automated rebalancing. + +
+ } + > } diff --git a/packages/dev-frontend/src/components/Stability/validation/validateStabilityDepositChange.tsx b/packages/dev-frontend/src/components/Stability/validation/validateStabilityDepositChange.tsx index 1918cd8f9..afcebe160 100644 --- a/packages/dev-frontend/src/components/Stability/validation/validateStabilityDepositChange.tsx +++ b/packages/dev-frontend/src/components/Stability/validation/validateStabilityDepositChange.tsx @@ -71,8 +71,6 @@ export const validateStabilityDepositChange = ( {change.depositLUSD.sub(lusdBalance).prettify()} {COIN} - .
- You can mint LUSD here ]; } From 90adb67524bfe2316c49491d56d769da23f95511 Mon Sep 17 00:00:00 2001 From: shmuel Date: Mon, 11 Oct 2021 16:42:13 +0300 Subject: [PATCH 16/17] add dot --- .../Stability/validation/validateStabilityDepositChange.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/dev-frontend/src/components/Stability/validation/validateStabilityDepositChange.tsx b/packages/dev-frontend/src/components/Stability/validation/validateStabilityDepositChange.tsx index afcebe160..3a7b9110d 100644 --- a/packages/dev-frontend/src/components/Stability/validation/validateStabilityDepositChange.tsx +++ b/packages/dev-frontend/src/components/Stability/validation/validateStabilityDepositChange.tsx @@ -71,6 +71,7 @@ export const validateStabilityDepositChange = ( {change.depositLUSD.sub(lusdBalance).prettify()} {COIN} + . ]; } From 8a0eca75a11b774d0b84904a02a6fd565c71ad13 Mon Sep 17 00:00:00 2001 From: shmuel Date: Mon, 11 Oct 2021 16:46:25 +0300 Subject: [PATCH 17/17] text change --- packages/dev-frontend/src/components/Stability/NoDeposit.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dev-frontend/src/components/Stability/NoDeposit.tsx b/packages/dev-frontend/src/components/Stability/NoDeposit.tsx index e77f1da98..d65c2ff6c 100644 --- a/packages/dev-frontend/src/components/Stability/NoDeposit.tsx +++ b/packages/dev-frontend/src/components/Stability/NoDeposit.tsx @@ -63,7 +63,7 @@ export const NoDeposit: React.FC = props => { tooltip={ - Deposit LUSD only via B.Protocol for automated rebalancing. + Deposit your LUSD only via B.Protocol for automated rebalancing. }