Skip to content

Commit

Permalink
Merge branch 'develop' into adam/oct-1825-initial-passthrough-fastapi…
Browse files Browse the repository at this point in the history
…-server
  • Loading branch information
aziolek committed Oct 10, 2024
2 parents d634fd5 + 17ad94f commit 2bae451
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
5 changes: 4 additions & 1 deletion backend/app/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,10 @@
}

TIMEOUT_LIST = set()
TIMEOUT_LIST_NOT_MAINNET = {"0xdf486eeC7b89C390569194834a2f7A71da05Ee13"}
TIMEOUT_LIST_NOT_MAINNET = {
"0xdf486eeC7b89C390569194834a2f7A71da05Ee13",
"0x689f1A51c177cCE66E3AfDcA4b1DeD7721f531F9",
}

GUEST_LIST_STAMP_PROVIDERS = [
"AllowList#OctantFinal",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import BoxRounded from 'components/ui/BoxRounded';
import Sections from 'components/ui/BoxRounded/Sections/Sections';
import { SectionProps } from 'components/ui/BoxRounded/Sections/types';
import useGetValuesToDisplay from 'hooks/helpers/useGetValuesToDisplay';
import useCurrentEpoch from 'hooks/queries/useCurrentEpoch';
import useEpochLeverage from 'hooks/queries/useEpochLeverage';
import useIndividualReward from 'hooks/queries/useIndividualReward';
import useIsDecisionWindowOpen from 'hooks/queries/useIsDecisionWindowOpen';
import useUserAllocations from 'hooks/queries/useUserAllocations';
import useAllocationsStore from 'store/allocations/store';
import { formatUnitsBigInt } from 'utils/formatUnitsBigInt';
Expand All @@ -24,6 +27,9 @@ const AllocationSummary: FC<AllocationSummaryProps> = ({
});
const { data: individualReward } = useIndividualReward();
const { data: userAllocations } = useUserAllocations();
const { data: isDecisionWindowOpen } = useIsDecisionWindowOpen();
const { data: currentEpoch } = useCurrentEpoch();
const { data: epochLeverage } = useEpochLeverage(currentEpoch! - 1);
const { rewardsForProjects } = useAllocationsStore(state => ({
rewardsForProjects: state.data.rewardsForProjects,
}));
Expand All @@ -48,19 +54,21 @@ const AllocationSummary: FC<AllocationSummaryProps> = ({
valueCrypto: rewardsForProjects,
});

const leverage = isDecisionWindowOpen ? allocationSimulated?.leverage : epochLeverage?.toString();

const matchingFundSumToDisplay =
rewardsForProjects && allocationSimulated?.leverage
rewardsForProjects && leverage
? getValuesToDisplay({
cryptoCurrency: 'ethereum',
valueCrypto: rewardsForProjects * BigInt(parseInt(allocationSimulated.leverage, 10)),
valueCrypto: rewardsForProjects * BigInt(parseInt(leverage, 10)),
}).primary
: undefined;
const totalImpactToDisplay = getValuesToDisplay({
cryptoCurrency: 'ethereum',
showCryptoSuffix: true,
valueCrypto:
rewardsForProjects && allocationSimulated
? rewardsForProjects * BigInt(parseInt(allocationSimulated.leverage, 10) + 1)
rewardsForProjects && leverage
? rewardsForProjects * BigInt(parseInt(leverage, 10) + 1)
: rewardsForProjects,
}).primary;
const personalToDisplay = individualReward
Expand All @@ -84,7 +92,7 @@ const AllocationSummary: FC<AllocationSummaryProps> = ({
isLoadingAllocateSimulate && styles.isLoading,
)}
>
{allocationSimulated ? `${parseInt(allocationSimulated.leverage, 10)}x` : undefined}
{leverage ? `${parseInt(leverage, 10)}x` : undefined}
</span>
</div>
</div>
Expand Down
8 changes: 7 additions & 1 deletion client/src/hooks/queries/useAntisybilStatusScore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@ export default function useAntisybilStatusScore(
const { data: isUserTOSAccepted } = useUserTOS();

return useQuery({
enabled: !!address && isUserTOSAccepted,
/**
* !! required, as address: string & isUserTOSAccepted: undefined gives undefined,
* so query is done when it shouldn't be.
*/
//
enabled: !!(!!address && isUserTOSAccepted),
queryFn: () => apiGetAntisybilStatus(address!),
queryKey: QUERY_KEYS.antisybilStatus(address!),
refetchOnMount: true,
retry: false,
select: ({ score, isOnTimeOutList }) => ({
isOnTimeOutList,
score: Math.round(parseFloat(score)),
Expand Down

0 comments on commit 2bae451

Please sign in to comment.