Skip to content

Commit

Permalink
Merge branch 'develop' into fix/oct-1505-proposals-cid-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
aziolek committed Apr 10, 2024
2 parents 5fb01ee + 4f10ae3 commit 204f635
Show file tree
Hide file tree
Showing 32 changed files with 410 additions and 90 deletions.
14 changes: 7 additions & 7 deletions ci/argocd/contracts/uat.env
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
BLOCK_NUMBER=5652838
BLOCK_NUMBER=5654008
GLM_CONTRACT_ADDRESS=0x71432DD1ae7DB41706ee6a22148446087BdD0906
AUTH_CONTRACT_ADDRESS=0x1a98D5fb178e63be8970F24d5f900bd9906C184A
DEPOSITS_CONTRACT_ADDRESS=0x37c5364E7c95df8F355d68181Bd5d257765077d2
EPOCHS_CONTRACT_ADDRESS=0x2946547419F7Ae4F08a7447038158eE028886db7
PROPOSALS_CONTRACT_ADDRESS=0x0ffD9d36cC7CECFCB2Da929a416497669d0b2Bfd
WITHDRAWALS_TARGET_CONTRACT_ADDRESS=0x71CeaAdB6e2ff28e59c5098525F25CC494650e5D
VAULT_CONTRACT_ADDRESS=0x286baF6a4c8d047b821Ea25C8cfe977369d0087B
AUTH_CONTRACT_ADDRESS=0xF5c7A09df8a0422B490cB215c6B3bC473A1C87A3
DEPOSITS_CONTRACT_ADDRESS=0x2043c7262A19493cD293d865c56482AF122f8882
EPOCHS_CONTRACT_ADDRESS=0xcdba82F0AfEe0B6b0aa78C5D6F9DA526834d6d5f
PROPOSALS_CONTRACT_ADDRESS=0x026293cc6A739fe0E1E7a602fbB1bEea7CfE82E6
WITHDRAWALS_TARGET_CONTRACT_ADDRESS=0x2e7efFafDf380ac0e699478C89368BaF7d0ebF5d
VAULT_CONTRACT_ADDRESS=0xcCFEF3B1eE18ee4e020F434D07b12f5E6272a253
8 changes: 4 additions & 4 deletions client/cypress/e2e/onboarding.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { visitWithLoader, navigateWithCheck, mockCoinPricesServer } from 'cypress/utils/e2e';
import viewports from 'cypress/utils/viewports';
import { stepsDecisionWindowClosed } from 'src/hooks/helpers/useOnboardingSteps/steps';
import { getStepsDecisionWindowClosed } from 'src/hooks/helpers/useOnboardingSteps/steps';
import { ROOT, ROOT_ROUTES } from 'src/routes/RootRoutes/routes';

import Chainable = Cypress.Chainable;
Expand Down Expand Up @@ -230,12 +230,12 @@ Object.values(viewports).forEach(({ device, viewportWidth, viewportHeight }) =>
});

it('user is able to click through entire onboarding flow', () => {
for (let i = 1; i < stepsDecisionWindowClosed.length - 1; i++) {
for (let i = 1; i < getStepsDecisionWindowClosed('2', '16 Jan').length - 1; i++) {
checkProgressStepperSlimIsCurrentAndClickNext(i);
}

cy.get('[data-test=ModalOnboarding__ProgressStepperSlim__element]')
.eq(stepsDecisionWindowClosed.length - 1)
.eq(getStepsDecisionWindowClosed('2', '16 Jan').length - 1)
.click();
cy.get('[data-test=ModalOnboarding__Button]').click();
cy.get('[data-test=ModalOnboarding]').should('not.exist');
Expand Down Expand Up @@ -322,7 +322,7 @@ Object.values(viewports).forEach(({ device, viewportWidth, viewportHeight }) =>
});

it('user is not able to click through entire onboarding flow', () => {
for (let i = 1; i < stepsDecisionWindowClosed.length; i++) {
for (let i = 1; i < getStepsDecisionWindowClosed('2', '16 Jan').length; i++) {
checkProgressStepperSlimIsCurrentAndClickNext(i, i === 1);
}
});
Expand Down
Binary file removed client/public/images/onboarding/earn-rewards.webp
Binary file not shown.
Binary file removed client/public/images/onboarding/get-involved.webp
Binary file not shown.
43 changes: 43 additions & 0 deletions client/src/api/calls/multisigSignatures.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import env from 'env';
import apiService from 'services/apiService';

// eslint-disable-next-line no-shadow
export enum SignatureOpType {
ALLOCATION = 'allocation',
TOS = 'tos',
}

export type PendingMultisigSignatures = {
hash: string | undefined;
message: string | undefined;
};

export async function apiGetPendingMultisigSignatures(
userAddress: string,
signatureOpType: SignatureOpType,
): Promise<PendingMultisigSignatures> {
return apiService
.get(`${env.serverEndpoint}multisig-signatures/pending/${userAddress}/type/${signatureOpType}`)
.then(({ data }) => data);
}

export async function apiPostPendingMultisigSignatures(
userAddress: string,
message:
| string
| {
isManuallyEdited: boolean;
payload: {
allocations: { amount: string; proposalAddress: string }[];
nonce: number;
};
},
signatureOpType: SignatureOpType,
): Promise<any> {
return apiService
.post(
`${env.serverEndpoint}multisig-signatures/pending/${userAddress}/type/${signatureOpType}`,
{ message },
)
.then(({ data }) => data);
}
2 changes: 2 additions & 0 deletions client/src/api/queryKeys/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Root, QueryKeys } from './types';

export const ROOTS: Root = {
bytecode: 'bytecode',
calculateRewards: 'calculateRewards',
cryptoValues: 'cryptoValues',
depositAt: 'depositAt',
Expand All @@ -27,6 +28,7 @@ export const ROOTS: Root = {

export const QUERY_KEYS: QueryKeys = {
blockNumber: ['blockNumber'],
bytecode: userAddress => [ROOTS.bytecode, userAddress],
calculateRewards: (amount, days) => [ROOTS.calculateRewards, amount, days.toString()],
cryptoValues: fiatCurrency => [ROOTS.cryptoValues, fiatCurrency],
currentEpoch: ['currentEpoch'],
Expand Down
2 changes: 2 additions & 0 deletions client/src/api/queryKeys/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { SettingsData } from 'store/settings/types';

export type Root = {
bytecode: 'bytecode';
calculateRewards: 'calculateRewards';
cryptoValues: 'cryptoValues';
depositAt: 'depositAt';
Expand All @@ -27,6 +28,7 @@ export type Root = {

export type QueryKeys = {
blockNumber: ['blockNumber'];
bytecode: (userAddress: string) => [Root['bytecode'], string];
calculateRewards: (amount: string, days: number) => [Root['calculateRewards'], string, string];
cryptoValues: (
fiatCurrency: NonNullable<SettingsData['displayCurrency']>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const AllocationNavigation: FC<AllocationNavigationProps> = ({
onAllocate,
onResetValues,
setCurrentView,
isWaitingForWalletConfirmationMultisig,
}) => {
const { t } = useTranslation('translation', {
keyPrefix: 'components.dedicated.allocationNavigation',
Expand All @@ -28,9 +29,9 @@ const AllocationNavigation: FC<AllocationNavigationProps> = ({
onClick: onResetValues,
};
const buttonNextProps =
currentView === 'edit'
isWaitingForWalletConfirmationMultisig || currentView === 'edit'
? {
label: t('confirm'),
label: isWaitingForWalletConfirmationMultisig ? t('waiting') : t('confirm'),
onClick: onAllocate,
}
: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export default interface AllocationNavigationProps {
currentView: CurrentView;
isLeftButtonDisabled: boolean;
isLoading: boolean;
isWaitingForWalletConfirmationMultisig?: boolean;
onAllocate: () => void;
onResetValues: () => void;
setCurrentView: (newView: CurrentView) => void;
Expand Down
7 changes: 6 additions & 1 deletion client/src/components/Earn/EarnGlmLock/EarnGlmLock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import useMediaQuery from 'hooks/helpers/useMediaQuery';
import useLock from 'hooks/mutations/useLock';
import useUnlock from 'hooks/mutations/useUnlock';
import useDepositValue from 'hooks/queries/useDepositValue';
import useIsContract from 'hooks/queries/useIsContract';
import useProjectsEpoch from 'hooks/queries/useProjectsEpoch';
import toastService from 'services/toastService';
import useTransactionLocalStore from 'store/transactionLocal/store';
Expand All @@ -30,6 +31,7 @@ const EarnGlmLock: FC<EarnGlmLockProps> = ({ currentMode, onCurrentModeChange, o
const publicClient = usePublicClient();
const { data: walletClient } = useWalletClient();
const { isDesktop } = useMediaQuery();
const { data: isContract } = useIsContract();
const [transactionHashForEtherscan, setTransactionHashForEtherscan] = useState<
string | undefined
>(undefined);
Expand Down Expand Up @@ -105,12 +107,15 @@ const EarnGlmLock: FC<EarnGlmLockProps> = ({ currentMode, onCurrentModeChange, o
const onSuccess = async ({ hash, value }): Promise<void> => {
addTransactionPending({
amount: value,
isMultisig: isContract,
// GET /history uses microseconds. Normalization here.
timestamp: (Date.now() * 1000).toString(),
transactionHash: hash,
type: currentMode,
});
setTransactionHashForEtherscan(hash);
if (!isContract) {
setTransactionHashForEtherscan(hash);
}
};

const onReset: OnReset = ({ setFieldValue, newMode = 'lock' }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import styles from './EarnHistoryItem.module.scss';
import EarnHistoryItemProps from './types';

const EarnHistoryItem: FC<EarnHistoryItemProps> = ({ isLast, ...rest }) => {
const { type, amount, isFinalized = true, timestamp } = rest;
const { type, amount, isFinalized = true, timestamp, isMultisig = false } = rest;
const { i18n, t } = useTranslation('translation', {
keyPrefix: 'components.dedicated.historyItem',
});
Expand Down Expand Up @@ -65,7 +65,9 @@ const EarnHistoryItem: FC<EarnHistoryItemProps> = ({ isLast, ...rest }) => {
{getHistoryItemDateAndTime(timestamp)}
</div>
) : (
type !== 'allocation' && <EarnHistoryTransactionLabel isFinalized={isFinalized} />
type !== 'allocation' && (
<EarnHistoryTransactionLabel isFinalized={isFinalized} isMultisig={isMultisig} />
)
)}
</div>
<DoubleValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ import { TransactionPending } from 'store/transactionLocal/types';
export default interface EarnHistoryItemProps extends HistoryElement {
isFinalized?: TransactionPending['isFinalized'];
isLast: boolean;
isMultisig?: boolean;
isWaitingForTransactionInitialized?: TransactionPending['isWaitingForTransactionInitialized'];
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
.viewOnEtherscan {
padding: 0;

&.isMultisig {
opacity: 0.5;
pointer-events: none;
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import cx from 'classnames';
import React, { FC } from 'react';
import { useTranslation } from 'react-i18next';
import { useTransaction } from 'wagmi';
Expand All @@ -20,6 +21,7 @@ const EarnHistoryItemDetailsRest: FC<EarnHistoryItemDetailsRestProps> = ({
transactionHash,
isFinalized = true,
isWaitingForTransactionInitialized,
isMultisig = false,
}) => {
const { t } = useTranslation('translation', {
keyPrefix: 'components.dedicated.historyItemModal',
Expand Down Expand Up @@ -52,10 +54,12 @@ const EarnHistoryItemDetailsRest: FC<EarnHistoryItemDetailsRestProps> = ({
label: t('sections.gasPrice'),
},
{
childrenLeft: <EarnHistoryTransactionLabel isFinalized={isFinalized} />,
childrenLeft: (
<EarnHistoryTransactionLabel isFinalized={isFinalized} isMultisig={isMultisig} />
),
childrenRight: (
<Button
className={styles.viewOnEtherscan}
className={cx(styles.viewOnEtherscan, isMultisig && styles.isMultisig)}
href={`${networkConfig.etherscanAddress}/tx/${transactionHash}`}
label={t('sections.viewOnEtherscan')}
variant="link"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
import cx from 'classnames';
import React, { FC } from 'react';
import React, { FC, useMemo } from 'react';
import { useTranslation } from 'react-i18next';

import styles from './EarnHistoryTransactionLabel.module.scss';
import EarnHistoryTransactionLabelProps from './types';

const EarnHistoryTransactionLabel: FC<EarnHistoryTransactionLabelProps> = ({ isFinalized }) => {
const EarnHistoryTransactionLabel: FC<EarnHistoryTransactionLabelProps> = ({
isFinalized,
isMultisig,
}) => {
const { t } = useTranslation('translation', {
keyPrefix: 'components.dedicated.historyTransactionLabel',
});
return (
<div className={cx(styles.root, isFinalized && styles.isFinalized)}>
{isFinalized ? t('confirmed') : t('pending')}
</div>
);

const label = useMemo(() => {
if (isMultisig) {
return t('pendingMultisig');
}
if (isFinalized) {
return t('confirmed');
}
return t('pending');
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isFinalized, isMultisig]);

return <div className={cx(styles.root, isFinalized && styles.isFinalized)}>{label}</div>;
};

export default EarnHistoryTransactionLabel;
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export default interface EarnHistoryTransactionLabelProps {
isFinalized: boolean;
isMultisig?: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,11 @@
align-items: center;
justify-content: center;
}

.link {
text-decoration: underline;

@media #{$desktop-up} {
text-decoration: none;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.box {
height: 8rem;
margin-top: 1.6rem;
position: relative;

.text {
margin-left: 1.8rem;
Expand All @@ -9,13 +10,37 @@
line-height: 2.4rem;
color: $color-octant-grey5;
cursor: pointer;

&.isWaitingForWalletConfirmationMultisig {
opacity: 0.5;
}
}

.link {
font-weight: $font-weight-semibold;
text-decoration: underline;

@media #{$desktop-up} {
&:hover {
text-decoration: underline;
}

text-decoration: none;
}

&:hover {
transform: none;
}
}

.waitingForWalletConfirmation {
position: absolute;
right: 0;
bottom: -2.4rem;
height: 2.4rem;
color: $color-octant-grey5;
font-weight: $font-weight-bold;
font-size: $font-size-10;
text-align: right;
}
}
Loading

0 comments on commit 204f635

Please sign in to comment.