Collateral calculation bug fix
This commit is contained in:
parent
2aec3d297f
commit
fcb82e3695
@ -454,7 +454,8 @@
|
||||
<svg class="icon" xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"></path><path d="M11.8 10.9c-2.27-.59-3-1.2-3-2.15 0-1.09 1.01-1.85 2.7-1.85 1.78 0 2.44.85 2.5 2.1h2.21c-.07-1.72-1.12-3.3-3.21-3.81V3h-3v2.16c-1.94.42-3.5 1.68-3.5 3.61 0 2.31 1.91 3.46 4.7 4.13 2.5.6 3 1.48 3 2.41 0 .69-.49 1.79-2.7 1.79-2.06 0-2.87-.92-2.98-2.1h-2.2c.12 2.19 1.76 3.42 3.68 3.83V21h3v-2.15c1.95-.37 3.5-1.5 3.5-3.55 0-2.84-2.43-3.81-4.7-4.4z"></path></svg>
|
||||
</div>
|
||||
</sm-input>
|
||||
<p>Collateral amount: <b>${formatAmount((loanAmount / floGlobals.btcRate) * loan_collateral_ratio)}</b></p>
|
||||
|
||||
<p>Collateral amount: <b>${formatAmount(btcMortgage.util.calcRequiredCollateral((loanAmount / floGlobals.btcRate), loan_collateral_ratio))}</b></p>
|
||||
<div class="grid gap-1">
|
||||
<label class="interact">
|
||||
<input type="radio" name="collateral_type" value="self" checked=${selfCollateral} onchange=${() => setSelfCollateral(true)} required>
|
||||
@ -500,7 +501,7 @@
|
||||
</div>
|
||||
<div class="grid gap-0-5">
|
||||
<h5>Collateral amount</h5>
|
||||
<p>${formatAmount((loanAmount / floGlobals.btcRate) * loan_collateral_ratio)}</p>
|
||||
<p>${formatAmount(btcMortgage.util.calcRequiredCollateral((loanAmount / floGlobals.btcRate), loan_collateral_ratio))}</p>
|
||||
</div>
|
||||
<div class="grid gap-0-5">
|
||||
<h5>Collateral provider</h5>
|
||||
@ -653,7 +654,7 @@
|
||||
const [verifyingCollateral, setVerifyCollateral] = useState(false)
|
||||
let collateralAmount = 0
|
||||
if (!isLender)
|
||||
collateralAmount = btcMortgage.util.toFixedDecimal(btcMortgage.policies[policyID]?.loan_collateral_ratio * (loanAmount / floGlobals.btcRate)) || 0
|
||||
collateralAmount = btcMortgage.util.calcRequiredCollateral((loanAmount / floGlobals.btcRate), btcMortgage.policies[policyID]?.loan_collateral_ratio) || 0
|
||||
async function verifyCollateral(e) {
|
||||
const confirmation = await getConfirmation('Verify collateral?', { message: `You are about to check for ${formatAmount(collateralAmount)} as collateral. Continue?`, confirmText: 'Verify', cancelText: 'Cancel' })
|
||||
if (!confirmation)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user