Skip to content

Commit

Permalink
Add slippage setting to recover modal
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenshively committed Sep 26, 2024
1 parent e7655bb commit 1d408c4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion earn/src/components/markets/modal/RecoverModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { base } from 'viem/chains';
import { useReadContract, useSimulateContract, useWriteContract } from 'wagmi';

import AddressDropdown from '../../common/AddressDropdown';
import MaxSlippageInput from '../../common/MaxSlippageInput';
import { SupplyTableRow } from '../supply/SupplyTable';

const SECONDARY_COLOR = 'rgba(130, 160, 182, 1)';
Expand Down Expand Up @@ -86,6 +87,7 @@ export default function RecoverModal({
}) {
const activeChain = useChain();
const [selectedOption, setSelectedOption] = useState(OPTIONS[activeChain.id][0]);
const [slippage, setSlippage] = useState('0.10');

const { data: balanceResult } = useReadContract({
abi: lenderAbi,
Expand Down Expand Up @@ -125,7 +127,7 @@ export default function RecoverModal({
selectedRow.kitty.address,
selectedOption.borrower,
selectedOption.flashPool,
10n,
BigInt((Number(slippage) * 100).toFixed(0)),
balanceResult ?? 0n,
BigInt(permitResult.deadline),
permitResult.signature?.v ?? 0,
Expand Down Expand Up @@ -170,6 +172,7 @@ export default function RecoverModal({
setSelectedOption(OPTIONS[activeChain.id].find((option) => option.borrower === borrowerAddress)!)
}
/>
<MaxSlippageInput updateMaxSlippage={setSlippage} />
<div className='flex flex-col gap-1 w-full'>
<Text size='M' weight='bold'>
Explanation
Expand Down

0 comments on commit 1d408c4

Please sign in to comment.