-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into root-format
- Loading branch information
Showing
40 changed files
with
451 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
# Node | ||
node_modules/ | ||
pnpm-debug.log* | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
public-hoist-pattern[]=@chakra-ui/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lts/iron |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
# Hardhat | ||
build/ | ||
cache/ | ||
export.json | ||
export/ | ||
node_modules/ | ||
typechain/ | ||
yarn-debug.log* | ||
yarn-error.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"detectors_to_exclude": "assembly,naming-convention,timestamp,pragma,solc-version", | ||
"hardhat_artifacts_directory": "build", | ||
"filter_paths": "node_modules/.*" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
VITE_USE_TESTNET=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,2 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? | ||
# Output | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,26 @@ | ||
# Acre dApp | ||
|
||
## Installation | ||
|
||
1. Install dependencies and start the app. | ||
```bash | ||
yarn install | ||
yarn start | ||
``` | ||
2. Open [http://localhost:5173](http://localhost:5173) to view it in the browser. | ||
The application is compatible with Ledger Live and allows people to earn yield on their Bitcoin via yield farming on Ethereum. | ||
|
||
This project was bootstrapped with [Create Vite](https://github.com/vitejs/vite/tree/main/packages/create-vite). | ||
|
||
## Quickstart | ||
|
||
Install dependencies and start the app. | ||
|
||
```bash | ||
pnpm install | ||
pnpm run start | ||
``` | ||
|
||
Once the build is running, you can import the manifest on desktop: | ||
|
||
1. [Install Ledger Live Desktop](https://www.ledger.com/ledger-live) | ||
2. Enable the Developer mode | ||
|
||
Go to the **Settings -> About** section, and click 10 times on the Ledger Live version. A new Developer section appears in the settings menu. Turn on **Enable platform dev** tools to use the developer tools window to inspect your app. | ||
3. Add your manifest | ||
|
||
Click on Browse next to **Add a local app** and select the manifest file. The app is now visible in the menu. | ||
|
||
If you have any problems, take a look [here](https://developers.ledger.com/docs/non-dapp/tutorial/3-import/#desktop). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import React from "react" | ||
import { Box, Button, Image, Text } from "@chakra-ui/react" | ||
import { Account } from "@ledgerhq/wallet-api-client" | ||
import BitcoinIcon from "../../assets/bitcoin.svg" | ||
import EthereumIcon from "../../assets/ethereum.svg" | ||
import InfoIcon from "../../assets/info.svg" | ||
import { BITCOIN } from "../../constants" | ||
import { | ||
useRequestBitcoinAccount, | ||
useRequestEthereumAccount, | ||
useWalletContext, | ||
} from "../../hooks" | ||
import { formatSatoshiAmount, truncateAddress } from "../../utils" | ||
|
||
export type ConnectButtonsProps = { | ||
leftIcon: string | ||
rightIcon: string | ||
account: Account | undefined | ||
requestAccount: () => Promise<void> | ||
} | ||
|
||
function ConnectButton({ | ||
leftIcon, | ||
rightIcon, | ||
account, | ||
requestAccount, | ||
}: ConnectButtonsProps) { | ||
const styles = !account ? { color: "error", borderColor: "error" } : undefined | ||
return ( | ||
<Button | ||
variant="outline" | ||
sx={styles} | ||
leftIcon={<Image src={leftIcon} />} | ||
// TODO: Add a tooltip here | ||
rightIcon={!account ? <Image src={rightIcon} /> : undefined} | ||
onClick={requestAccount} | ||
> | ||
{account ? truncateAddress(account.address) : "Not connected"} | ||
</Button> | ||
) | ||
} | ||
|
||
export default function ConnectWallet() { | ||
const { requestAccount: requestBitcoinAccount } = useRequestBitcoinAccount() | ||
const { requestAccount: requestEthereumAccount } = useRequestEthereumAccount() | ||
const { btcAccount, ethAccount } = useWalletContext() | ||
|
||
return ( | ||
<Box display="flex" alignItems="center" gap="4"> | ||
<Box display="flex" gap="2"> | ||
<Text>Balance</Text> | ||
<Text as="b"> | ||
{!btcAccount || btcAccount?.balance.isZero() | ||
? "0.00" | ||
: formatSatoshiAmount(btcAccount.balance.toString())} | ||
</Text> | ||
<Text>{BITCOIN.symbol}</Text> | ||
</Box> | ||
<ConnectButton | ||
leftIcon={BitcoinIcon} | ||
rightIcon={InfoIcon} | ||
account={btcAccount} | ||
requestAccount={async () => { | ||
await requestBitcoinAccount() | ||
}} | ||
/> | ||
<ConnectButton | ||
leftIcon={EthereumIcon} | ||
rightIcon={InfoIcon} | ||
account={ethAccount} | ||
requestAccount={async () => { | ||
await requestEthereumAccount() | ||
}} | ||
/> | ||
</Box> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from "react" | ||
import { Box } from "@chakra-ui/react" | ||
import ConnectWallet from "./ConnectWallet" | ||
|
||
export default function Navbar() { | ||
return ( | ||
<Box p={4} display="flex" justifyContent="end"> | ||
<ConnectWallet /> | ||
</Box> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Currency } from "../types" | ||
|
||
export const BITCOIN: Currency = { | ||
name: "Bitcoin", | ||
symbol: "BTC", | ||
decimals: 8, | ||
} | ||
|
||
export const ETHEREUM: Currency = { | ||
name: "Ethereum", | ||
symbol: "ETH", | ||
decimals: 18, | ||
} | ||
|
||
export const CURRENCY_ID_BITCOIN = | ||
import.meta.env.VITE_USE_TESTNET === "true" ? "bitcoin_testnet" : "bitcoin" | ||
|
||
export const CURRENCY_ID_ETHEREUM = | ||
import.meta.env.VITE_USE_TESTNET === "true" ? "ethereum_goerli" : "ethereum" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./currency" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.