fix(repay): transaction message when selecting max amount & unused vars (#423)

This commit is contained in:
Yusuf Seyrek 2023-09-04 22:02:57 +03:00 committed by GitHub
parent 270f2e1c58
commit b7019023f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,7 +54,6 @@ export default function BorrowModalController() {
function BorrowModal(props: Props) { function BorrowModal(props: Props) {
const { modal, account } = props const { modal, account } = props
const [percentage, setPercentage] = useState(0)
const [amount, setAmount] = useState(BN_ZERO) const [amount, setAmount] = useState(BN_ZERO)
const [isConfirming, setIsConfirming] = useToggle() const [isConfirming, setIsConfirming] = useToggle()
const [borrowToWallet, setBorrowToWallet] = useToggle() const [borrowToWallet, setBorrowToWallet] = useToggle()
@ -71,7 +70,6 @@ function BorrowModal(props: Props) {
function resetState() { function resetState() {
setAmount(BN_ZERO) setAmount(BN_ZERO)
setPercentage(0)
setIsConfirming(false) setIsConfirming(false)
} }
@ -87,7 +85,7 @@ function BorrowModal(props: Props) {
result = await repay({ result = await repay({
accountId: account.id, accountId: account.id,
coin: BNCoin.fromDenomAndBigNumber(asset.denom, amount), coin: BNCoin.fromDenomAndBigNumber(asset.denom, amount),
accountBalance: percentage === 100, accountBalance: max.isEqualTo(amount),
lends, lends,
}) })
} else { } else {
@ -110,16 +108,6 @@ function BorrowModal(props: Props) {
useStore.setState({ borrowModal: null }) useStore.setState({ borrowModal: null })
} }
const liquidityAmountString = formatValue(modal.marketData?.liquidity?.amount.toString() || 0, {
abbreviated: true,
decimals: 6,
})
const liquidityValueString = formatValue(modal.marketData?.liquidity?.value.toString() || 0, {
abbreviated: true,
decimals: 6,
})
const handleChange = useCallback( const handleChange = useCallback(
(newAmount: BigNumber) => { (newAmount: BigNumber) => {
const coin = BNCoin.fromDenomAndBigNumber(asset.denom, newAmount) const coin = BNCoin.fromDenomAndBigNumber(asset.denom, newAmount)