update suggested values (#350)

This commit is contained in:
Adrian Brzeziński 2023-12-14 23:25:07 +01:00 committed by GitHub
parent d36c0ba360
commit a24f7d5dae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 183 additions and 7 deletions

View File

@ -504,6 +504,102 @@ const DashboardSuggestedValues = ({
`${suggestedFields.liquidationFee}%`
}
/>
<KeyValuePair
label="Group Insurance Fund"
value={`${formattedBankValues.groupInsuranceFund}`}
proposedValue={
suggestedFields.groupInsuranceFund !== undefined &&
`${suggestedFields.groupInsuranceFund}`
}
/>
<KeyValuePair
label="Net Borrow Limit Window Size Ts"
value={`${formattedBankValues.netBorrowLimitWindowSizeTs}`}
proposedValue={
suggestedFields.netBorrowLimitWindowSizeTs !== undefined &&
`${suggestedFields.netBorrowLimitWindowSizeTs}`
}
/>
<KeyValuePair
label="Stable Price Delay Interval Seconds"
value={`${formattedBankValues.stablePriceDelayIntervalSeconds}`}
proposedValue={
suggestedFields.stablePriceDelayIntervalSeconds !== undefined &&
`${suggestedFields.stablePriceDelayIntervalSeconds}`
}
/>
<KeyValuePair
label="Stable Price Growth Limit"
value={`${formattedBankValues.stablePriceGrowthLimit}`}
proposedValue={
suggestedFields.stablePriceGrowthLimit !== undefined &&
`${suggestedFields.stablePriceGrowthLimit}`
}
/>
<KeyValuePair
label="Stable Price Delay Growth Limit"
value={`${formattedBankValues.stablePriceDelayGrowthLimit}`}
proposedValue={
suggestedFields.stablePriceDelayGrowthLimit !== undefined &&
`${suggestedFields.stablePriceDelayGrowthLimit}`
}
/>
<KeyValuePair
label="Token Conditional Swap Taker Fee Rate"
value={`${formattedBankValues.tokenConditionalSwapTakerFeeRate}`}
proposedValue={
suggestedFields.tokenConditionalSwapTakerFeeRate !== undefined &&
`${suggestedFields.tokenConditionalSwapTakerFeeRate}`
}
/>
<KeyValuePair
label="Token Conditional Swap Maker Fee Rate"
value={`${formattedBankValues.tokenConditionalSwapMakerFeeRate}`}
proposedValue={
suggestedFields.tokenConditionalSwapMakerFeeRate !== undefined &&
`${suggestedFields.tokenConditionalSwapMakerFeeRate}`
}
/>
<KeyValuePair
label="Interest Target Utilization"
value={`${formattedBankValues.interestTargetUtilization}`}
proposedValue={
suggestedFields.interestTargetUtilization !== undefined &&
`${suggestedFields.interestTargetUtilization}`
}
/>
<KeyValuePair
label="Interest Curve Scaling"
value={`${formattedBankValues.interestCurveScaling}`}
proposedValue={
suggestedFields.interestCurveScaling !== undefined &&
`${suggestedFields.interestCurveScaling}`
}
/>
<KeyValuePair
label="Deposit Limit"
value={`${formattedBankValues.depositLimit}`}
proposedValue={
suggestedFields.depositLimit !== undefined &&
`${suggestedFields.depositLimit}`
}
/>
<KeyValuePair
label="Flash Loan Swap Fee Rate"
value={`${formattedBankValues.flashLoanSwapFeeRate}`}
proposedValue={
suggestedFields.flashLoanSwapFeeRate !== undefined &&
`${suggestedFields.flashLoanSwapFeeRate}`
}
/>
<KeyValuePair
label="Reduce Only"
value={`${formattedBankValues.reduceOnly}`}
proposedValue={
suggestedFields.reduceOnly !== undefined &&
`${suggestedFields.reduceOnly}`
}
/>
<div>
<h3 className="mb-4 pl-6">Price impacts</h3>
{priceImpactsFiltered.map((x) => (

View File

@ -408,7 +408,61 @@ const Dashboard: NextPage = () => {
label="Oracle: Max Staleness"
value={`${bank.oracleConfig.maxStalenessSlots} slots (Last updated slot ${bank._oracleLastUpdatedSlot})`}
/>
<KeyValuePair
label="Deposit limit"
value={
formattedBankValues.depositLimit
? `${formattedBankValues.depositLimit} ${
bank.name
} ($${(
formattedBankValues.depositLimit *
bank.uiPrice
).toFixed(2)})`
: 'None'
}
/>
<KeyValuePair
label="Interest Curve Scaling"
value={
formattedBankValues.interestCurveScaling
}
/>
<KeyValuePair
label="Interest Targe tUtilization"
value={
formattedBankValues.interestTargetUtilization
}
/>
<KeyValuePair
label="Maint Weight Shift Start"
value={
formattedBankValues.maintWeightShiftStart
}
/>
<KeyValuePair
label="Maint Weight Shift End"
value={
formattedBankValues.maintWeightShiftEnd
}
/>
<KeyValuePair
label="Maint Weight Shift Asset Target"
value={
formattedBankValues.maintWeightShiftAssetTarget
}
/>
<KeyValuePair
label="Maint Weight Shift Liab Target"
value={
formattedBankValues.maintWeightShiftLiabTarget
}
/>
<KeyValuePair
label="Maint Weight Shift Duration Inv"
value={
formattedBankValues.maintWeightShiftDurationInv
}
/>
{bank.mint.toBase58() !== USDC_MINT && (
<div className="mb-4 mt-2 flex">
<Button

View File

@ -268,12 +268,7 @@ export const getQuoteSymbol = (quoteTokenSymbol: string) => {
}
export const formatSuggestedValues = (
suggestedParams:
| Record<string, never>
| Omit<
ListingPreset,
'name' | 'netBorrowLimitWindowSizeTs' | 'groupInsuranceFund'
>,
suggestedParams: Record<string, never> | Omit<ListingPreset, 'name'>,
) => {
return {
maxStalenessSlots: suggestedParams.maxStalenessSlots,
@ -306,6 +301,22 @@ export const formatSuggestedValues = (
suggestedParams.depositWeightScaleStartQuote,
6,
),
groupInsuranceFund: suggestedParams.groupInsuranceFund,
netBorrowLimitWindowSizeTs: suggestedParams.netBorrowLimitWindowSizeTs,
stablePriceDelayIntervalSeconds:
suggestedParams.stablePriceDelayIntervalSeconds,
stablePriceGrowthLimit: suggestedParams.stablePriceGrowthLimit,
stablePriceDelayGrowthLimit: suggestedParams.stablePriceDelayGrowthLimit,
tokenConditionalSwapTakerFeeRate:
suggestedParams.tokenConditionalSwapTakerFeeRate,
tokenConditionalSwapMakerFeeRate:
suggestedParams.tokenConditionalSwapMakerFeeRate,
interestTargetUtilization:
suggestedParams.interestTargetUtilization.toString(),
interestCurveScaling: suggestedParams.interestCurveScaling.toString(),
depositLimit: suggestedParams.depositLimit,
flashLoanSwapFeeRate: suggestedParams.flashLoanSwapFeeRate,
reduceOnly: suggestedParams.reduceOnly,
}
}
@ -401,6 +412,21 @@ export const getFormattedBankValues = (group: Group, bank: Bank) => {
6,
),
liquidationFee: (bank.liquidationFee.toNumber() * 100).toFixed(2),
interestCurveScaling: bank.interestCurveScaling.toString(),
interestTargetUtilization: bank.interestTargetUtilization.toString(),
maintWeightShiftStart: bank.maintWeightShiftStart.toNumber(),
maintWeightShiftEnd: bank.maintWeightShiftEnd.toNumber(),
maintWeightShiftAssetTarget: bank.maintWeightShiftAssetTarget.toNumber(),
maintWeightShiftLiabTarget: bank.maintWeightShiftLiabTarget.toNumber(),
maintWeightShiftDurationInv: bank.maintWeightShiftDurationInv.toNumber(),
depositLimit: toUiDecimals(bank.depositLimit, bank.mintDecimals),
stablePriceDelayIntervalSeconds: bank.stablePriceModel.delayIntervalSeconds,
stablePriceGrowthLimit: bank.stablePriceModel.stableGrowthLimit,
stablePriceDelayGrowthLimit: bank.stablePriceModel.delayGrowthLimit,
netBorrowLimitWindowSizeTs: bank.netBorrowLimitWindowSizeTs.toNumber(),
reduceOnly: bank.reduceOnly,
groupInsuranceFund: !!group?.mintInfosMapByMint.get(bank.mint.toString())
?.groupInsuranceFund,
}
}