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

202406 snagging #11

Merged
merged 3 commits into from
Jun 26, 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
2 changes: 2 additions & 0 deletions src/components/liquidation-pools/StakedAssets.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const StakedAssets = ({

const isLoading = loading;

console.log('DEBUG')

return (
<>
<Card className="card-compact w-full">
Expand Down
25 changes: 14 additions & 11 deletions src/components/liquidation-pools/WithdrawModal.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { useState, useEffect, useRef } from "react";
import { toast } from 'react-toastify';

import {
useWriteContract,
useChainId,
} from "wagmi";
import { arbitrumSepolia } from "wagmi/chains";
import { ethers } from "ethers";
import { toast } from 'react-toastify';
import { formatEther, parseEther } from "viem";

import {
useLiquidationPoolStore,
Expand Down Expand Up @@ -49,11 +50,11 @@ const WithdrawModal = ({
const tstAvailable = BigInt(tstStakedAmount) - BigInt(tstPending);
const eurosAvailable = BigInt(eurosStakedAmount) - BigInt(eurosPending);

const showTstPending = ethers.formatEther(tstPending.toString());
const showEurosPending = ethers.formatEther(eurosPending.toString());
const showTstPending = formatEther(tstPending.toString());
const showEurosPending = formatEther(eurosPending.toString());

const showTstAvailable = ethers.formatEther(tstAvailable.toString());
const showEurosAvailable = ethers.formatEther(eurosAvailable.toString());
const showTstAvailable = formatEther(tstAvailable.toString());
const showEurosAvailable = formatEther(eurosAvailable.toString());

const hasPending = (tstPending > 0) || (eurosPending > 0);

Expand All @@ -69,8 +70,8 @@ const WithdrawModal = ({
address: liquidationPoolAddress,
functionName: "decreasePosition",
args: [
ethers.parseEther(tstWithdrawAmount.toString()),
ethers.parseEther(eurosWithdrawAmount.toString()),
parseEther(tstWithdrawAmount.toString()),
parseEther(eurosWithdrawAmount.toString()),
],
});
} catch (error) {
Expand All @@ -93,7 +94,9 @@ const WithdrawModal = ({
handleCloseModal();
} else if (isError) {
toast.error('There was a problem');
setShowError(true)
setShowError(true);
// TEMP
console.log('isError:', error)
setClaimLoading(false);
setTstWithdrawAmount(0);
setEurosWithdrawAmount(0);
Expand All @@ -112,7 +115,7 @@ const WithdrawModal = ({
};

const handleTstInputMax = () => {
const formatBalance = ethers.formatEther(tstAvailable);
const formatBalance = formatEther(tstAvailable);
tstInputRef.current.value = formatBalance;

handleTstAmount({target: {value: formatBalance}});
Expand All @@ -125,7 +128,7 @@ const WithdrawModal = ({
};

const handleEurosInputMax = () => {
const formatBalance = ethers.formatEther(eurosAvailable);
const formatBalance = formatEther(eurosAvailable);
eurosInputRef.current.value = formatBalance;
handleEurosAmount({target: {value: formatBalance}});
}
Expand Down
Loading