Skip to content

Commit 738fa14

Browse files
committed
fix: adjust incentivize time for testing claims in my incentivization history
1 parent f8c30fa commit 738fa14

File tree

1 file changed

+12
-48
lines changed

1 file changed

+12
-48
lines changed

packages/web/src/views/pool/pool-incentivize/containers/incentivize-pool-modal-container/IncentivizePoolModalContainer.tsx

Lines changed: 12 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,22 @@ import { useMessage } from "@hooks/common/use-message";
1212
import { usePositionData } from "@hooks/common/use-position-data";
1313
import { useTransactionConfirmModal } from "@hooks/common/use-transaction-confirm-modal";
1414
import { useTransactionEventStore } from "@hooks/common/use-transaction-event-store";
15-
import {
16-
useGetIncentivizePoolList,
17-
useGetPoolList,
18-
useRefetchGetPoolDetailByPath,
19-
} from "@query/pools";
15+
import { useGetIncentivizePoolList, useGetPoolList, useRefetchGetPoolDetailByPath } from "@query/pools";
2016
import { useGetPoolStakingListByAddress } from "@query/pools/use-get-pool-staking-list-by-address";
2117
import { DexEvent } from "@repositories/common";
2218
import { EarnState } from "@states/index";
2319

2420
import IncentivizePoolModal from "../../components/incentivize-pool-modal/IncentivizePoolModal";
2521

26-
const DAY_TIME = 24 * 60 * 60;
22+
const DAY_TIME = 60;
2723
const MILLISECONDS = 1000;
2824

2925
interface IncentivizePoolModalContainerProps {
3026
poolPath?: string;
3127
}
3228

33-
const IncentivizePoolModalContainer: React.FC<
34-
IncentivizePoolModalContainerProps
35-
> = ({ poolPath }) => {
36-
const {
37-
broadcastSuccess,
38-
broadcastError,
39-
broadcastRejected,
40-
broadcastLoading,
41-
} = useBroadcastHandler();
29+
const IncentivizePoolModalContainer: React.FC<IncentivizePoolModalContainerProps> = ({ poolPath }) => {
30+
const { broadcastSuccess, broadcastError, broadcastRejected, broadcastLoading } = useBroadcastHandler();
4231
const { enqueueEvent } = useTransactionEventStore();
4332
const router = useRouter();
4433
const clearModal = useClearModal();
@@ -55,11 +44,8 @@ const IncentivizePoolModalContainer: React.FC<
5544

5645
const { refetch: refetchPools } = useGetPoolList();
5746
const { refetch: refetchIncentivizePools } = useGetIncentivizePoolList();
58-
const { refetch: refetchPoolDetails } =
59-
useRefetchGetPoolDetailByPath(poolPath);
60-
const { refetch: refetchStakingList } = useGetPoolStakingListByAddress(
61-
address || "",
62-
);
47+
const { refetch: refetchPoolDetails } = useRefetchGetPoolDetailByPath(poolPath);
48+
const { refetch: refetchStakingList } = useGetPoolStakingListByAddress(address || "");
6349

6450
const { getMessage } = useMessage();
6551

@@ -74,25 +60,15 @@ const IncentivizePoolModalContainer: React.FC<
7460
}
7561
}, [clearModal, router]);
7662

77-
const { openModal: openTransactionConfirmModal } = useTransactionConfirmModal(
78-
{
79-
closeCallback: onCloseConfirmTransactionModal,
80-
},
81-
);
63+
const { openModal: openTransactionConfirmModal } = useTransactionConfirmModal({
64+
closeCallback: onCloseConfirmTransactionModal,
65+
});
8266

8367
const onSubmit = useCallback(() => {
8468
if (!pool || !dataModal?.token) {
8569
return null;
8670
}
87-
const startUTCDate = Date.UTC(
88-
startDate.year,
89-
startDate.month - 1,
90-
startDate.date,
91-
0,
92-
0,
93-
0,
94-
0,
95-
);
71+
const startUTCDate = Date.UTC(startDate.year, startDate.month - 1, startDate.date, 0, 0, 0, 0);
9672
// `startTime` is current UTC time to Unix timestamp
9773
const startTime = new Date(startUTCDate).getTime() / MILLISECONDS;
9874
// `endTime` adds the period time to the start unix time.
@@ -117,10 +93,7 @@ const IncentivizePoolModalContainer: React.FC<
11793
})
11894
.then(response => {
11995
if (response) {
120-
if (
121-
response.code === 0 ||
122-
response.code === ERROR_VALUE.TRANSACTION_FAILED.status
123-
) {
96+
if (response.code === 0 || response.code === ERROR_VALUE.TRANSACTION_FAILED.status) {
12497
enqueueEvent({
12598
txHash: response.data?.hash,
12699
action: DexEvent.ADD_INCENTIVE,
@@ -182,16 +155,7 @@ const IncentivizePoolModalContainer: React.FC<
182155
console.log(e);
183156
return null;
184157
});
185-
}, [
186-
poolRepository,
187-
dataModal,
188-
period,
189-
pool,
190-
router,
191-
startDate.date,
192-
startDate.month,
193-
startDate.year,
194-
]);
158+
}, [poolRepository, dataModal, period, pool, router, startDate.date, startDate.month, startDate.year]);
195159

196160
return (
197161
<IncentivizePoolModal

0 commit comments

Comments
 (0)