Skip to content

Commit

Permalink
fix: adjust incentivize time for testing claims in my incentivization…
Browse files Browse the repository at this point in the history
… history
  • Loading branch information
jinoosss committed Nov 12, 2024
1 parent c0be32b commit 0e4523a
Showing 1 changed file with 12 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,22 @@ import { useMessage } from "@hooks/common/use-message";
import { usePositionData } from "@hooks/common/use-position-data";
import { useTransactionConfirmModal } from "@hooks/common/use-transaction-confirm-modal";
import { useTransactionEventStore } from "@hooks/common/use-transaction-event-store";
import {
useGetIncentivizePoolList,
useGetPoolList,
useRefetchGetPoolDetailByPath,
} from "@query/pools";
import { useGetIncentivizePoolList, useGetPoolList, useRefetchGetPoolDetailByPath } from "@query/pools";
import { useGetPoolStakingListByAddress } from "@query/pools/use-get-pool-staking-list-by-address";
import { DexEvent } from "@repositories/common";
import { EarnState } from "@states/index";

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

const DAY_TIME = 24 * 60 * 60;
const DAY_TIME = 60;
const MILLISECONDS = 1000;

interface IncentivizePoolModalContainerProps {
poolPath?: string;
}

const IncentivizePoolModalContainer: React.FC<
IncentivizePoolModalContainerProps
> = ({ poolPath }) => {
const {
broadcastSuccess,
broadcastError,
broadcastRejected,
broadcastLoading,
} = useBroadcastHandler();
const IncentivizePoolModalContainer: React.FC<IncentivizePoolModalContainerProps> = ({ poolPath }) => {
const { broadcastSuccess, broadcastError, broadcastRejected, broadcastLoading } = useBroadcastHandler();
const { enqueueEvent } = useTransactionEventStore();
const router = useRouter();
const clearModal = useClearModal();
Expand All @@ -55,11 +44,8 @@ const IncentivizePoolModalContainer: React.FC<

const { refetch: refetchPools } = useGetPoolList();
const { refetch: refetchIncentivizePools } = useGetIncentivizePoolList();
const { refetch: refetchPoolDetails } =
useRefetchGetPoolDetailByPath(poolPath);
const { refetch: refetchStakingList } = useGetPoolStakingListByAddress(
address || "",
);
const { refetch: refetchPoolDetails } = useRefetchGetPoolDetailByPath(poolPath);
const { refetch: refetchStakingList } = useGetPoolStakingListByAddress(address || "");

const { getMessage } = useMessage();

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

const { openModal: openTransactionConfirmModal } = useTransactionConfirmModal(
{
closeCallback: onCloseConfirmTransactionModal,
},
);
const { openModal: openTransactionConfirmModal } = useTransactionConfirmModal({
closeCallback: onCloseConfirmTransactionModal,
});

const onSubmit = useCallback(() => {
if (!pool || !dataModal?.token) {
return null;
}
const startUTCDate = Date.UTC(
startDate.year,
startDate.month - 1,
startDate.date,
0,
0,
0,
0,
);
const startUTCDate = Date.UTC(startDate.year, startDate.month - 1, startDate.date, 0, 0, 0, 0);
// `startTime` is current UTC time to Unix timestamp
const startTime = new Date(startUTCDate).getTime() / MILLISECONDS;
// `endTime` adds the period time to the start unix time.
Expand All @@ -117,10 +93,7 @@ const IncentivizePoolModalContainer: React.FC<
})
.then(response => {
if (response) {
if (
response.code === 0 ||
response.code === ERROR_VALUE.TRANSACTION_FAILED.status
) {
if (response.code === 0 || response.code === ERROR_VALUE.TRANSACTION_FAILED.status) {
enqueueEvent({
txHash: response.data?.hash,
action: DexEvent.ADD_INCENTIVE,
Expand Down Expand Up @@ -182,16 +155,7 @@ const IncentivizePoolModalContainer: React.FC<
console.log(e);
return null;
});
}, [
poolRepository,
dataModal,
period,
pool,
router,
startDate.date,
startDate.month,
startDate.year,
]);
}, [poolRepository, dataModal, period, pool, router, startDate.date, startDate.month, startDate.year]);

return (
<IncentivizePoolModal
Expand Down

0 comments on commit 0e4523a

Please sign in to comment.