Skip to content
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
5 changes: 3 additions & 2 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ VITE_RPC_URL=""
VITE_API_BASE_URL="https://florin.bitcoinos.build"
VITE_EXPIRATION_HOURS=24
VITE_MIN_AMOUNT="0.0004"
VITE_MAX_AMOUT="3"
VITE_MAX_AMOUNT="3"
VITE_EVM_CONFIRMATIONS_LOW=1
VITE_EVM_CONFIRMATIONS_HIGH=10
VITE_EVM_CONFIRMATIONS_USD_AMOUNT=100
VITE_BTC_CONFIRMATIONS=6
VITE_BTC_CONFIRMATIONS=6
VITE_DEFAULT_POSITION_ID=
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
VITE_EVM_CONFIRMATIONS_HIGH: ${{ secrets.VITE_EVM_CONFIRMATIONS_HIGH }}
VITE_EVM_CONFIRMATIONS_USD_AMOUNT: ${{ secrets.VITE_EVM_CONFIRMATIONS_USD_AMOUNT }}
VITE_BTC_CONFIRMATIONS: ${{ secrets.VITE_BTC_CONFIRMATIONS }}
VITE_DEFAULT_POSITION_ID: ${{ secrets.VITE_DEFAULT_POSITION_ID }}

- name: Build
run: npm run build
Expand All @@ -54,4 +55,5 @@ jobs:
VITE_EVM_CONFIRMATIONS_LOW: ${{ secrets.VITE_EVM_CONFIRMATIONS_LOW }}
VITE_EVM_CONFIRMATIONS_HIGH: ${{ secrets.VITE_EVM_CONFIRMATIONS_HIGH }}
VITE_EVM_CONFIRMATIONS_USD_AMOUNT: ${{ secrets.VITE_EVM_CONFIRMATIONS_USD_AMOUNT }}
VITE_BTC_CONFIRMATIONS: ${{ secrets.VITE_BTC_CONFIRMATIONS }}
VITE_BTC_CONFIRMATIONS: ${{ secrets.VITE_BTC_CONFIRMATIONS }}
VITE_DEFAULT_POSITION_ID: ${{ secrets.VITE_DEFAULT_POSITION_ID }}
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
VITE_EVM_CONFIRMATIONS_HIGH: ${{ secrets.VITE_EVM_CONFIRMATIONS_HIGH }}
VITE_EVM_CONFIRMATIONS_USD_AMOUNT: ${{ secrets.VITE_EVM_CONFIRMATIONS_USD_AMOUNT }}
VITE_BTC_CONFIRMATIONS: ${{ secrets.VITE_BTC_CONFIRMATIONS }}
VITE_DEFAULT_POSITION_ID: ${{ secrets.VITE_DEFAULT_POSITION_ID }}
- name: Deploy to Netlify
run: |
DEPLOY_COMMAND="netlify deploy \
Expand Down
43 changes: 42 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,53 @@ yarn preview
The application uses environment variables for configuration. Create a `.env` file in the root directory with the following variables:

```env
# WalletConnect project ID for wallet connection functionality
VITE_WALLETCONNECT_PROJECT_ID=""

# RPC URL for connecting to the Ethereum network
VITE_RPC_URL=""
VITE_API_BASE_URL=""

# Base URL for the Florin API endpoints
VITE_API_BASE_URL="https://florin.bitcoinos.build"

# Number of hours until a transaction expires
VITE_EXPIRATION_HOURS=24

# Minimum amount allowed for transactions (in BTC)
VITE_MIN_AMOUNT="0.0004"

# Maximum amount allowed for transactions (in BTC)
VITE_MAX_AMOUNT="3"

# Number of confirmations required for low-value related to VITE_EVM_CONFIRMATIONS_USD_AMOUNT EVM transactions
VITE_EVM_CONFIRMATIONS_LOW=1

# Number of confirmations required for high-value EVM transactions
VITE_EVM_CONFIRMATIONS_HIGH=10

# USD amount threshold that determines when to use high confirmations
VITE_EVM_CONFIRMATIONS_USD_AMOUNT=100

# Number of confirmations required for Bitcoin transactions
VITE_BTC_CONFIRMATIONS=6

# Default position id for reservation
VITE_DEFAULT_POSITION_ID=
```

## Contract Addresses Configuration
The application uses different contract addresses for different networks. These addresses are configured in `src/constants/contracts.ts`. To modify the contract addresses:

1. Navigate to `src/constants/contracts.ts`
2. Update the addresses in the `CONTRACTS_ADDRESS` object for the desired network:
- `ammExchange`: AMM Exchange contract address
- `marketMakerProxy`: Market Maker Proxy contract address
- `florinForwarder`: Florin Forwarder contract address
- `erc20BitSnark`: ERC20 BitSnark token contract address
- `contractRegistry`: Contract Registry address

The file supports multiple networks, Sepolia testnet (chain ID: 11155111) and local development (chain ID: 31337).

## Main Scripts
- `npm run dev` - Start development server
- `npm run build` - Create production build
Expand Down
5 changes: 4 additions & 1 deletion src/config/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ const envSchema = z.object({
}),
VITE_BTC_CONFIRMATIONS: z.string().transform((val) => Number(val)).refine((val) => val > 0, {
message: 'VITE_BTC_CONFIRMATIONS must be greater than 0',
})
}),
VITE_DEFAULT_POSITION_ID: z.string().min(1, {
message: 'VITE_DEFAULT_POSITION_ID is required',
}),
});

const parsed = envSchema.safeParse(import.meta.env);
Expand Down
3 changes: 2 additions & 1 deletion src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { env } from "@/config/env";
import { PositionStatus, ReservationStatus } from "@/types";

export const DEFAULT_POSITION_ID = '0xf0e94d3b55389b66f693bf6a4ae0eec46a1e61342c9efeaa96ba6ada1d555ca2';
export const DEFAULT_POSITION_ID = env.VITE_DEFAULT_POSITION_ID;
export const ETHERSCAN_URL = 'https://sepolia.etherscan.io';
export const BITCOIN_TESTNET_URL = 'https://mempool.space/testnet4';

Expand Down
Loading