Skip to content

Commit 0591126

Browse files
authored
hotfix: GBI-2647 and GBI-2648 (#706)
1 parent 8401669 commit 0591126

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

internal/adapters/entrypoints/rest/assets/static/management.js

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -358,16 +358,26 @@ const showWarningToast = (warningMessage) => {
358358
};
359359

360360
function checkFeeWarnings() {
361-
const fixedFeeCheckbox = document.querySelector('input[data-key="fixedFee_enabled"]');
362-
const feePercentageCheckbox = document.querySelector('input[data-key="feePercentage_enabled"]');
361+
const sections = ['generalConfig', 'peginConfig', 'pegoutConfig'];
363362
const existingToast = document.getElementById('warningToast');
364-
365-
if (fixedFeeCheckbox && feePercentageCheckbox) {
366-
if (!fixedFeeCheckbox.checked && !feePercentageCheckbox.checked) {
367-
if (!existingToast) showWarningToast('It is recommended to enable at least one of "feePercentage" or "fixedFee".');
368-
} else {
369-
if (existingToast) existingToast.parentNode.removeChild(existingToast);
363+
const shouldWarn = sections.some(sectionId => {
364+
const sectionElement = document.getElementById(sectionId);
365+
if (!sectionElement) return false;
366+
const fixedFeeCheckbox = sectionElement.querySelector('input[data-key="fixedFee_enabled"]');
367+
const feePercentageCheckbox = sectionElement.querySelector('input[data-key="feePercentage_enabled"]');
368+
return (
369+
fixedFeeCheckbox &&
370+
feePercentageCheckbox &&
371+
!fixedFeeCheckbox.checked &&
372+
!feePercentageCheckbox.checked
373+
);
374+
});
375+
if (shouldWarn) {
376+
if (!existingToast) {
377+
showWarningToast('It is recommended to enable at least one of "feePercentage" or "fixedFee".');
370378
}
379+
} else if (existingToast) {
380+
existingToast.parentNode.removeChild(existingToast);
371381
}
372382
}
373383

pkg/liquidity_provider.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ type PeginConfigurationDTO struct {
4747
CallTime uint32 `json:"callTime" validate:"required"`
4848
PenaltyFee string `json:"penaltyFee" validate:"required,numeric,positive_string"`
4949
FixedFee string `json:"fixedFee" validate:"required,numeric,min=0"`
50-
FeePercentage float64 `json:"feePercentage" validate:"numeric,gte=0,lt=100,max_decimal_places=2"`
50+
FeePercentage float64 `json:"feePercentage" validate:"numeric,gte=0,lte=100,max_decimal_places=2"`
5151
MaxValue string `json:"maxValue" validate:"required,numeric,positive_string"`
5252
MinValue string `json:"minValue" validate:"required,numeric,positive_string"`
5353
}
@@ -61,7 +61,7 @@ type PegoutConfigurationDTO struct {
6161
ExpireTime uint32 `json:"expireTime" validate:"required"`
6262
PenaltyFee string `json:"penaltyFee" validate:"required,numeric,positive_string"`
6363
FixedFee string `json:"fixedFee" validate:"required,numeric,min=0"`
64-
FeePercentage float64 `json:"feePercentage" validate:"required,gte=0,lt=100,max_decimal_places=2"`
64+
FeePercentage float64 `json:"feePercentage" validate:"numeric,gte=0,lte=100,max_decimal_places=2"`
6565
MaxValue string `json:"maxValue" validate:"required,numeric,positive_string"`
6666
MinValue string `json:"minValue" validate:"required,numeric,positive_string"`
6767
ExpireBlocks uint64 `json:"expireBlocks" validate:"required"`

0 commit comments

Comments
 (0)