From 4a40c2ca4f1aa8d10e59b58bee8bedb55212c4b2 Mon Sep 17 00:00:00 2001 From: Dmitrii Podlesnyi Date: Thu, 29 Jun 2023 19:07:15 +0400 Subject: [PATCH] feat: new motion factories and creation forms added, obsolete forms removed --- .env.sample | 4 - modules/blockChain/contractAddresses.ts | 111 +++-------- modules/blockChain/contracts.ts | 20 ++ modules/blockChain/hooks/useGnosisOpener.ts | 6 +- modules/blockChain/types.ts | 3 + modules/blockChain/utils/getBackendRpcUrl.ts | 3 - modules/blockChain/utils/getGnosisSafeLink.ts | 14 +- modules/motions/constants.ts | 10 +- modules/motions/evmAddresses.ts | 116 +++++------ modules/motions/hooks/useAvailableMotions.ts | 36 ++-- modules/motions/hooks/useContractEvmScript.ts | 6 + modules/motions/hooks/useEVMScriptDecoder.ts | 79 ++++---- modules/motions/hooks/useLegoTokenOptions.ts | 6 +- .../motions/hooks/useRegistryWithLimits.ts | 4 + modules/motions/hooks/useTokenByTopUpType.ts | 2 +- modules/motions/types.ts | 52 +++-- .../MotionDescription/MotionDescription.tsx | 21 ++ .../MotionFormComplete/MotionFormComplete.tsx | 5 +- .../MotionFormStartNew/MotionFormStartNew.tsx | 16 +- .../Parts/StartNewAllowedRecipientAdd.tsx | 21 +- .../Parts/StartNewAllowedRecipientRemove.tsx | 21 +- .../Parts/StartNewAllowedRecipientTopUp.tsx | 25 +-- .../Parts/StartNewReferralPartnerAdd.tsx | 91 --------- .../Parts/StartNewReferralPartnerRemove.tsx | 76 ------- .../Parts/StartNewReferralPartnerTopUp.tsx | 184 ----------------- .../Parts/StartNewRewardProgramAdd.tsx | 94 --------- .../Parts/StartNewRewardProgramRemove.tsx | 79 -------- .../Parts/StartNewRewardProgramTopUp.tsx | 188 ------------------ .../ui/MotionFormStartNew/Parts/index.ts | 101 ++++------ .../motions/utils/getMotionTypeDisplayName.ts | 31 +-- modules/shared/utils/sanitize.ts | 18 +- next.config.mjs | 10 +- pages/api/subgraph.ts | 6 +- 33 files changed, 327 insertions(+), 1132 deletions(-) delete mode 100644 modules/motions/ui/MotionFormStartNew/Parts/StartNewReferralPartnerAdd.tsx delete mode 100644 modules/motions/ui/MotionFormStartNew/Parts/StartNewReferralPartnerRemove.tsx delete mode 100644 modules/motions/ui/MotionFormStartNew/Parts/StartNewReferralPartnerTopUp.tsx delete mode 100644 modules/motions/ui/MotionFormStartNew/Parts/StartNewRewardProgramAdd.tsx delete mode 100644 modules/motions/ui/MotionFormStartNew/Parts/StartNewRewardProgramRemove.tsx delete mode 100644 modules/motions/ui/MotionFormStartNew/Parts/StartNewRewardProgramTopUp.tsx diff --git a/.env.sample b/.env.sample index 1f1dcd5a..f46079df 100644 --- a/.env.sample +++ b/.env.sample @@ -21,10 +21,6 @@ CSP_REPORT_URI= # subgraph urls SUBGRAPH_MAINNET=https://api.thegraph.com/subgraphs/name/lidofinance/lido -SUBGRAPH_ROPSTEN= -SUBGRAPH_RINKEBY= SUBGRAPH_GOERLI=https://api.thegraph.com/subgraphs/name/lidofinance/lido-testnet -SUBGRAPH_KOVAN= -SUBGRAPH_KINTSUGI= WALLETCONNECT_PROJECT_ID= diff --git a/modules/blockChain/contractAddresses.ts b/modules/blockChain/contractAddresses.ts index 5c58bf25..d5cc9f20 100644 --- a/modules/blockChain/contractAddresses.ts +++ b/modules/blockChain/contractAddresses.ts @@ -1,160 +1,97 @@ import { CHAINS } from '@lido-sdk/constants' +import type { ChainAddressMap } from './types' -export const NodeOperatorsRegistry = { +export const NodeOperatorsRegistry: ChainAddressMap = { [CHAINS.Mainnet]: '0x55032650b14df07b85bF18A3a3eC8E0Af2e028d5', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x7899EF901Ed9B331bAf7759c15D2e8728e8c2a2C', [CHAINS.Goerli]: '0x9D4AF1Ee19Dad8857db3a45B0374c81c8A1C6320', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const EasyTrack = { +export const EasyTrack: ChainAddressMap = { [CHAINS.Mainnet]: '0xF0211b7660680B49De1A7E9f25C65660F0a13Fea', - [CHAINS.Rinkeby]: '0x661090cB830757B2D0Cd53C49Bf0d17a28992e5d', [CHAINS.Goerli]: '0xAf072C8D368E4DD4A9d4fF6A76693887d6ae92Af', } -export const GovernanceToken = { +export const GovernanceToken: ChainAddressMap = { [CHAINS.Mainnet]: '0x5A98FcBEA516Cf06857215779Fd812CA3beF1B32', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x06c6Ab60F0Ad054236d7d4Faf98A5D33e852E717', [CHAINS.Goerli]: '0x56340274fB5a72af1A3C6609061c451De7961Bd4', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const RewardProgramRegistry = { +export const RewardProgramRegistry: ChainAddressMap = { [CHAINS.Mainnet]: '0x3129c041b372ee93a5a8756dc4ec6f154d85bc9a', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x648C8Be548F43eca4e482C0801Ebccccfb944931', [CHAINS.Goerli]: '0x28a08f61AE129d0d8BD4380Ae5647e7Add0527ca', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const ReferralPartnersRegistry = { +export const ReferralPartnersRegistry: ChainAddressMap = { [CHAINS.Mainnet]: '0xfCaD241D9D2A2766979A2de208E8210eDf7b7D4F', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x0000000000000000000000000000000000000000', [CHAINS.Goerli]: '0x4CB0c9987fd670069e4b24c653981E86b261A2ca', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const STETH = { +export const STETH: ChainAddressMap = { [CHAINS.Mainnet]: '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x06c6Ab60F0Ad054236d7d4Faf98A5D33e852E717', [CHAINS.Goerli]: '0x1643E812aE58766192Cf7D2Cf9567dF2C37e9B7F', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const DAI = { +export const DAI: ChainAddressMap = { [CHAINS.Mainnet]: '0x6B175474E89094C44Da98b954EedeAC495271d0F', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x0000000000000000000000000000000000000000', [CHAINS.Goerli]: '0x11fE4B6AE13d2a6055C8D9cF65c55bac32B5d844', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const Finance = { +export const Finance: ChainAddressMap = { [CHAINS.Mainnet]: '0xB9E5CBB9CA5b0d659238807E84D0176930753d86', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x72cd2b30020fb28de0dfa64d930a183eb732cf46', [CHAINS.Goerli]: '0x75c7b1D23f1cad7Fb4D60281d7069E46440BC179', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const AllowedRecipientRegistry = { +export const AllowedRecipientRegistry: ChainAddressMap = { [CHAINS.Mainnet]: '0xAa47c268e6b2D4ac7d7f7Ffb28A39484f5212c2A', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x0000000000000000000000000000000000000000', [CHAINS.Goerli]: '0xaDA19288575f611A6487365f0fE2A742a90BB2C6', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const AllowedRecipientReferralDaiRegistry = { +export const AllowedRecipientReferralDaiRegistry: ChainAddressMap = { [CHAINS.Mainnet]: '0xa295C212B44a48D07746d70d32Aa6Ca9b09Fb846', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x0000000000000000000000000000000000000000', [CHAINS.Goerli]: '0x8fB566b1e78e603a86b97ada5FcA858764dF4088', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const AllowedRecipientTrpLdoRegistry = { +export const AllowedRecipientTrpLdoRegistry: ChainAddressMap = { [CHAINS.Mainnet]: '0x231Ac69A1A37649C6B06a71Ab32DdD92158C80b8', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x0000000000000000000000000000000000000000', [CHAINS.Goerli]: '0x8C96a6522aEc036C4a384f8B7e05D93d6f3Dae39', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const LegoLDORegistry = { +export const LegoLDORegistry: ChainAddressMap = { [CHAINS.Mainnet]: '0x97615f72c3428A393d65A84A3ea6BBD9ad6C0D74', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x0000000000000000000000000000000000000000', [CHAINS.Goerli]: '0x6342213719839c56fEe817539863aFB9821B03cb', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const LegoDAIRegistry = { +export const LegoDAIRegistry: ChainAddressMap = { [CHAINS.Mainnet]: '0xb0FE4D300334461523D9d61AaD90D0494e1Abb43', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x0000000000000000000000000000000000000000', [CHAINS.Goerli]: '0x5884f5849414D4317d175fEc144e2F87f699B082', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const RccDAIRegistry = { +export const RccDAIRegistry: ChainAddressMap = { [CHAINS.Mainnet]: '0xDc1A0C7849150f466F07d48b38eAA6cE99079f80', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x0000000000000000000000000000000000000000', [CHAINS.Goerli]: '0x1440E8aDbE3a42a9EDB4b30059df8F6c35205a15', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const PmlDAIRegistry = { +export const PmlDAIRegistry: ChainAddressMap = { [CHAINS.Mainnet]: '0xDFfCD3BF14796a62a804c1B16F877Cf7120379dB', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x0000000000000000000000000000000000000000', [CHAINS.Goerli]: '0xAadfBd1ADE92d85c967f4aE096141F0F802F46Db', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const AtcDAIRegistry = { +export const AtcDAIRegistry: ChainAddressMap = { [CHAINS.Mainnet]: '0xe07305F43B11F230EaA951002F6a55a16419B707', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x0000000000000000000000000000000000000000', [CHAINS.Goerli]: '0xedD3B813275e1A88c2283FAfa5bf5396938ef59e', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const gasFunderETHRegistry = { +export const gasFunderETHRegistry: ChainAddressMap = { [CHAINS.Mainnet]: '0xCf46c4c7f936dF6aE12091ADB9897E3F2363f16F', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x0000000000000000000000000000000000000000', [CHAINS.Goerli]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const StethRewardProgramRegistry = { +export const StethRewardProgramRegistry: ChainAddressMap = { [CHAINS.Mainnet]: '0x48c4929630099b217136b64089E8543dB0E5163a', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x0000000000000000000000000000000000000000', [CHAINS.Goerli]: '0x78797efCca6C537BF92FA6b25cBb14A6f1c128A0', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', +} + +export const StethGasSupplyRegistry: ChainAddressMap = { + [CHAINS.Mainnet]: '0x49d1363016aA899bba09ae972a1BF200dDf8C55F', + [CHAINS.Goerli]: '0xF08a5f00824D4554a1FBebaE726609418dc819fb', } diff --git a/modules/blockChain/contracts.ts b/modules/blockChain/contracts.ts index ee796c60..0dbdbd1e 100644 --- a/modules/blockChain/contracts.ts +++ b/modules/blockChain/contracts.ts @@ -249,3 +249,23 @@ export const ContractStethRewardProgramTopUp = createContractHelpers({ factory: TopUpAllowedRecipientsAbi__factory, address: EvmAddressesByType[MotionType.StethRewardProgramTopUp], }) + +export const ContractStethGasSupplyRegistry = createContractHelpers({ + factory: AllowedRecipientsRegistryAbi__factory, + address: CONTRACT_ADDRESSES.StethGasSupplyRegistry, +}) + +export const ContractStethGasSupplyAdd = createContractHelpers({ + factory: AddAllowedRecipientAbi__factory, + address: EvmAddressesByType[MotionType.StethGasSupplyAdd], +}) + +export const ContractStethGasSupplyRemove = createContractHelpers({ + factory: RemoveAllowedRecipientAbi__factory, + address: EvmAddressesByType[MotionType.StethGasSupplyRemove], +}) + +export const ContractStethGasSupplyTopUp = createContractHelpers({ + factory: TopUpAllowedRecipientsAbi__factory, + address: EvmAddressesByType[MotionType.StethGasSupplyTopUp], +}) diff --git a/modules/blockChain/hooks/useGnosisOpener.ts b/modules/blockChain/hooks/useGnosisOpener.ts index fdee8f63..d5f27972 100644 --- a/modules/blockChain/hooks/useGnosisOpener.ts +++ b/modules/blockChain/hooks/useGnosisOpener.ts @@ -3,10 +3,10 @@ import { useWeb3 } from 'modules/blockChain/hooks/useWeb3' import { openWindow } from 'modules/shared/utils/openWindow' import { getGnosisSafeLink } from '../utils/getGnosisSafeLink' -export function useGnosisOpener(address: string, linkAddition?: string) { +export function useGnosisOpener(address: string, txHash: string) { const { chainId } = useWeb3() return useCallback(() => { - const link = getGnosisSafeLink(chainId, `${address}${linkAddition || ''}`) + const link = getGnosisSafeLink(chainId, address, txHash) openWindow(link) - }, [chainId, address, linkAddition]) + }, [chainId, address, txHash]) } diff --git a/modules/blockChain/types.ts b/modules/blockChain/types.ts index a67b1946..e55dcda9 100644 --- a/modules/blockChain/types.ts +++ b/modules/blockChain/types.ts @@ -1,4 +1,5 @@ import { ContractTransaction } from '@ethersproject/contracts' +import type { CHAINS } from '@lido-sdk/constants' export type SafeTx = { safeTxHash: string @@ -15,3 +16,5 @@ export type ResultTx = } export type TxStatus = 'empty' | 'pending' | 'failed' | 'success' + +export type ChainAddressMap = Partial> diff --git a/modules/blockChain/utils/getBackendRpcUrl.ts b/modules/blockChain/utils/getBackendRpcUrl.ts index f1cef7f8..06c46bb7 100644 --- a/modules/blockChain/utils/getBackendRpcUrl.ts +++ b/modules/blockChain/utils/getBackendRpcUrl.ts @@ -9,7 +9,4 @@ export const getBackendRpcUrl = (chainId: CHAINS) => { export const backendRPC = { [CHAINS.Mainnet]: getBackendRpcUrl(CHAINS.Mainnet), [CHAINS.Goerli]: getBackendRpcUrl(CHAINS.Goerli), - [CHAINS.Kovan]: getBackendRpcUrl(CHAINS.Kovan), - [CHAINS.Rinkeby]: getBackendRpcUrl(CHAINS.Rinkeby), - [CHAINS.Ropsten]: getBackendRpcUrl(CHAINS.Ropsten), } diff --git a/modules/blockChain/utils/getGnosisSafeLink.ts b/modules/blockChain/utils/getGnosisSafeLink.ts index 986671d7..6773fd65 100644 --- a/modules/blockChain/utils/getGnosisSafeLink.ts +++ b/modules/blockChain/utils/getGnosisSafeLink.ts @@ -6,9 +6,11 @@ const PREFIXES = { [CHAINS.Goerli]: 'gor', } as const -export const getGnosisSafeLink = (chainId: CHAINS, address: string) => - `https://app.safe.global/transactions/history?safe=${get( - PREFIXES, - chainId, - '?', - )}:${address}` +export const getGnosisSafeLink = ( + chainId: CHAINS, + address: string, + txHash: string, +) => { + const chain = get(PREFIXES, chainId, '?') + return `https://app.safe.global/transactions/tx?safe=${chain}:${address}&id=multisig_${address}_${txHash}` +} diff --git a/modules/motions/constants.ts b/modules/motions/constants.ts index 7f61ed26..b84f89ce 100644 --- a/modules/motions/constants.ts +++ b/modules/motions/constants.ts @@ -4,17 +4,13 @@ import * as CONTRACT_ADDRESSES from 'modules/blockChain/contractAddresses' export const MOTION_ATTENTION_PERIOD = 1 / 24 // https://snapshot.org/#/lido-snapshot.eth/proposal/0x75b331e650af1dc6bc98d4e705cfe19c74c55c02a53ad2ae85e207c6004ce847 -export const TRANSITION_LIMITS = [ - CHAINS.Mainnet, - CHAINS.Rinkeby, - CHAINS.Goerli, -].reduce( +export const TRANSITION_LIMITS = [CHAINS.Mainnet, CHAINS.Goerli].reduce( (res, chain) => ({ ...res, [chain]: { '0x0000000000000000000000000000000000000000': 1000, - [CONTRACT_ADDRESSES.STETH[chain]]: 1000, - [CONTRACT_ADDRESSES.GovernanceToken[chain]]: 5000000, + [CONTRACT_ADDRESSES.STETH[chain]!]: 1000, + [CONTRACT_ADDRESSES.GovernanceToken[chain]!]: 5000000, }, }), {} as Record>, diff --git a/modules/motions/evmAddresses.ts b/modules/motions/evmAddresses.ts index 5c027182..96029df3 100644 --- a/modules/motions/evmAddresses.ts +++ b/modules/motions/evmAddresses.ts @@ -13,12 +13,33 @@ export const EvmAddressesByChain = { [MotionType.NodeOperatorIncreaseLimit]: '0xFeBd8FAC16De88206d4b18764e826AF38546AfE0', [MotionType.LEGOTopUp]: '0x648C8Be548F43eca4e482C0801Ebccccfb944931', - // @deprecated + [MotionType.AllowedRecipientTopUpTrpLdo]: + '0xBd2b6dC189EefD51B273F5cb2d99BA1ce565fb8C', + [MotionType.LegoLDOTopUp]: '0x00caAeF11EC545B192f16313F53912E453c91458', + [MotionType.LegoDAITopUp]: '0x0535a67ea2D6d46f85fE568B7EaA91Ca16824FEC', + [MotionType.RccDAITopUp]: '0x84f74733ede9bFD53c1B3Ea96338867C94EC313e', + [MotionType.PmlDAITopUp]: '0x4E6D3A5023A38cE2C4c5456d3760357fD93A22cD', + [MotionType.AtcDAITopUp]: '0x67Fb97ABB9035E2e93A7e3761a0d0571c5d7CD07', + [MotionType.GasFunderETHTopUp]: + '0x41F9daC5F89092dD6061E59578A2611849317dc8', + [MotionType.StethRewardProgramAdd]: + '0x935cb3366Faf2cFC415B2099d1F974Fd27202b77', + [MotionType.StethRewardProgramRemove]: + '0x22010d1747CaFc370b1f1FBBa61022A313c5693b', + [MotionType.StethRewardProgramTopUp]: + '0x1F2b79FE297B7098875930bBA6dd17068103897E', + [MotionType.StethGasSupplyAdd]: + '0x48c135Ff690C2Aa7F5B11C539104B5855A4f9252', + [MotionType.StethGasSupplyRemove]: + '0x7E8eFfAb3083fB26aCE6832bFcA4C377905F97d7', + [MotionType.StethGasSupplyTopUp]: + '0x200dA0b6a9905A377CF8D469664C65dB267009d1', + + // next motion factories are @deprecated + // we are keeping them here to display history data [MotionType.RewardProgramAdd]: '0x9D15032b91d01d5c1D940eb919461426AB0dD4e3', - // @deprecated [MotionType.RewardProgramRemove]: '0xc21e5e72Ffc223f02fC410aAedE3084a63963932', - // @deprecated [MotionType.RewardProgramTopUp]: '0x77781A93C4824d2299a38AC8bBB11eb3cd6Bc3B7', [MotionType.ReferralPartnerAdd]: @@ -39,55 +60,6 @@ export const EvmAddressesByChain = { '0xd8f9B72Cd97388f23814ECF429cd18815F6352c1', [MotionType.AllowedRecipientTopUpReferralDai]: '0x009ffa22ce4388d2F5De128Ca8E6fD229A312450', - [MotionType.AllowedRecipientTopUpTrpLdo]: - '0xBd2b6dC189EefD51B273F5cb2d99BA1ce565fb8C', - [MotionType.LegoLDOTopUp]: '0x00caAeF11EC545B192f16313F53912E453c91458', - [MotionType.LegoDAITopUp]: '0x0535a67ea2D6d46f85fE568B7EaA91Ca16824FEC', - [MotionType.RccDAITopUp]: '0x84f74733ede9bFD53c1B3Ea96338867C94EC313e', - [MotionType.PmlDAITopUp]: '0x4E6D3A5023A38cE2C4c5456d3760357fD93A22cD', - [MotionType.AtcDAITopUp]: '0x67Fb97ABB9035E2e93A7e3761a0d0571c5d7CD07', - [MotionType.GasFunderETHTopUp]: - '0x41F9daC5F89092dD6061E59578A2611849317dc8', - [MotionType.StethRewardProgramAdd]: - '0x935cb3366Faf2cFC415B2099d1F974Fd27202b77', - [MotionType.StethRewardProgramRemove]: - '0x22010d1747CaFc370b1f1FBBa61022A313c5693b', - [MotionType.StethRewardProgramTopUp]: - '0x1F2b79FE297B7098875930bBA6dd17068103897E', - }, - - // Rinkeby - [CHAINS.Rinkeby]: { - [MotionType.NodeOperatorIncreaseLimit]: - '0xFE5986E06210aC1eCC1aDCafc0cc7f8D63B3F977', - [MotionType.LEGOTopUp]: '0xdA53fF207966b3946facaC52dD22B130D507d276', - // @deprecated - [MotionType.RewardProgramAdd]: '0x3129C041B372eE93a5A8756dc4EC6f154D85Bc9a', - // @deprecated - [MotionType.RewardProgramRemove]: - '0xc21e5e72Ffc223f02fC410aAedE3084a63963932', - // @deprecated - [MotionType.RewardProgramTopUp]: - '0xbb0f594143208eCd04DC7AAe48955902A716F9F7', - [MotionType.ReferralPartnerAdd]: '0x', - [MotionType.ReferralPartnerRemove]: '0x', - [MotionType.ReferralPartnerTopUp]: '0x', - [MotionType.AllowedRecipientAdd]: '0x', - [MotionType.AllowedRecipientRemove]: '0x', - [MotionType.AllowedRecipientTopUp]: '0x', - [MotionType.AllowedRecipientAddReferralDai]: '0x', - [MotionType.AllowedRecipientRemoveReferralDai]: '0x', - [MotionType.AllowedRecipientTopUpReferralDai]: '0x', - [MotionType.AllowedRecipientTopUpTrpLdo]: '0x', - [MotionType.LegoLDOTopUp]: '0x', - [MotionType.LegoDAITopUp]: '0x', - [MotionType.RccDAITopUp]: '0x', - [MotionType.PmlDAITopUp]: '0x', - [MotionType.AtcDAITopUp]: '0x', - [MotionType.GasFunderETHTopUp]: '0x', - [MotionType.StethRewardProgramAdd]: '0x', - [MotionType.StethRewardProgramRemove]: '0x', - [MotionType.StethRewardProgramTopUp]: '0x', }, // Goerli @@ -95,12 +67,32 @@ export const EvmAddressesByChain = { [MotionType.NodeOperatorIncreaseLimit]: '0xE033673D83a8a60500BcE02aBd9007ffAB587714', [MotionType.LEGOTopUp]: '0xb2bcf211F103d7F13789394DD475c2274e044C4C', - // @deprecated + [MotionType.AllowedRecipientTopUpTrpLdo]: + '0x43f33C52156d1Fb2eA24d82aBfD342E69835E79f', + [MotionType.LegoLDOTopUp]: '0xc39Dd5B66968e364D99e0c9E7089049351AB89CA', + [MotionType.LegoDAITopUp]: '0xbf44eC2b23cA105F8a62e0587900a09A473288c6', + [MotionType.RccDAITopUp]: '0xd0411e7c4A24E7d4509D5F13AEd19aeb8e5644AB', + [MotionType.PmlDAITopUp]: '0xc749aD24572263887Bc888d3Cb854FCD50eCCB61', + [MotionType.AtcDAITopUp]: '0xF4b8b5760EE4b5c5Cb154edd0f0841465d821006', + [MotionType.GasFunderETHTopUp]: '0x', + [MotionType.StethRewardProgramAdd]: + '0x785A8B1CDC03Bb191670Ed4696e9ED5B11Af910A', + [MotionType.StethRewardProgramRemove]: + '0xEFEa524D1739800fF6F7d2532ED4C8508220239a', + [MotionType.StethRewardProgramTopUp]: + '0xF2f7FC1E8879c10D4579Bc82D5FEa923A5a228dE', + [MotionType.StethGasSupplyAdd]: + '0xa2286d37Af8F8e84428151bF72922c5Fe5c1EeED', + [MotionType.StethGasSupplyRemove]: + '0x48D01979eD9e6CE70a6496B111F5728f9a547C96', + [MotionType.StethGasSupplyTopUp]: + '0x960CcA0BE6419e9684796Ce3ABE980E8a2d0cd80', + + // next motion factories are @deprecated + // we are keeping them here to display history data [MotionType.RewardProgramAdd]: '0x5560d40b00EA3a64E9431f97B3c79b04e0cdF6F2', - // @deprecated [MotionType.RewardProgramRemove]: '0x31B68d81125E52fE1aDfe4076F8945D1014753b5', - // @deprecated [MotionType.RewardProgramTopUp]: '0x8180949ac41EF18e844ff8dafE604a195d86Aea9', [MotionType.ReferralPartnerAdd]: @@ -121,20 +113,6 @@ export const EvmAddressesByChain = { '0x5FEC0bcd7519C4fE41eca5Fe1dD94345fA100A67', [MotionType.AllowedRecipientTopUpReferralDai]: '0x9534A77029D57E249c467E5A1E0854cc26Cd75A0', - [MotionType.AllowedRecipientTopUpTrpLdo]: - '0x43f33C52156d1Fb2eA24d82aBfD342E69835E79f', - [MotionType.LegoLDOTopUp]: '0xc39Dd5B66968e364D99e0c9E7089049351AB89CA', - [MotionType.LegoDAITopUp]: '0xbf44eC2b23cA105F8a62e0587900a09A473288c6', - [MotionType.RccDAITopUp]: '0xd0411e7c4A24E7d4509D5F13AEd19aeb8e5644AB', - [MotionType.PmlDAITopUp]: '0xc749aD24572263887Bc888d3Cb854FCD50eCCB61', - [MotionType.AtcDAITopUp]: '0xF4b8b5760EE4b5c5Cb154edd0f0841465d821006', - [MotionType.GasFunderETHTopUp]: '0x', - [MotionType.StethRewardProgramAdd]: - '0x785A8B1CDC03Bb191670Ed4696e9ED5B11Af910A', - [MotionType.StethRewardProgramRemove]: - '0xEFEa524D1739800fF6F7d2532ED4C8508220239a', - [MotionType.StethRewardProgramTopUp]: - '0xF2f7FC1E8879c10D4579Bc82D5FEa923A5a228dE', }, } diff --git a/modules/motions/hooks/useAvailableMotions.ts b/modules/motions/hooks/useAvailableMotions.ts index eb36db4b..328c8efd 100644 --- a/modules/motions/hooks/useAvailableMotions.ts +++ b/modules/motions/hooks/useAvailableMotions.ts @@ -7,17 +7,10 @@ import { EvmTypesByAdress, parseEvmSupportedChainId, } from 'modules/motions/evmAddresses' -import { MotionType } from 'modules/motions/types' import { useNodeOperatorsList } from './useNodeOperatorsList' import { EVM_CONTRACTS } from './useContractEvmScript' - -export const HIDDEN_MOTIONS = [ - 'RewardProgramAdd', - 'RewardProgramRemove', - 'RewardProgramTopUp', - 'LEGOTopUp', -] +import { MotionTypeForms } from 'modules/motions/types' const isHasTrustedCaller = ( contract: unknown, @@ -30,7 +23,7 @@ const isHasTrustedCaller = ( export const useAvailableMotions = () => { const { chainId, walletAddress } = useWeb3() const [availableMotions, setAvailableMotions] = - useState>() + useState>() const nodeOperators = useNodeOperatorsList() const currentNodeOperator = useMemo(() => { @@ -47,18 +40,16 @@ export const useAvailableMotions = () => { Boolean(currentNodeOperator) const nodeOperatorIncreaseLimitAddressMap = - EvmAddressesByType[MotionType.NodeOperatorIncreaseLimit] + EvmAddressesByType[MotionTypeForms.NodeOperatorIncreaseLimit] const nodeOperatorIncreaseLimitAddress = nodeOperatorIncreaseLimitAddressMap[parseEvmSupportedChainId(chainId)] - const contracts = useMemo( - () => - Object.values(EVM_CONTRACTS).filter( - contract => - contract.address[chainId] !== nodeOperatorIncreaseLimitAddress, - ), - [chainId, nodeOperatorIncreaseLimitAddress], - ) + const contracts = useMemo(() => { + return Object.values(EVM_CONTRACTS).filter( + contract => + contract.address[chainId] !== nodeOperatorIncreaseLimitAddress, + ) + }, [chainId, nodeOperatorIncreaseLimitAddress]) const getTrustedConnectionInfo = useCallback(async () => { const promiseResult = await Promise.allSettled( @@ -80,14 +71,15 @@ export const useAvailableMotions = () => { const contractType = EvmTypesByAdress[parseEvmSupportedChainId(chainId)][contractAddress] - if (HIDDEN_MOTIONS.includes(contractType)) return acc - acc[contractType] = cur.value === walletAddress + if (!Object.keys(MotionTypeForms).includes(contractType)) return acc + + acc[contractType as MotionTypeForms] = cur.value === walletAddress return acc }, { - [MotionType.NodeOperatorIncreaseLimit]: isNodeOperatorConnected, - } as Record, + [MotionTypeForms.NodeOperatorIncreaseLimit]: isNodeOperatorConnected, + } as Record, ) setAvailableMotions(trustedCallerConnectedMap) diff --git a/modules/motions/hooks/useContractEvmScript.ts b/modules/motions/hooks/useContractEvmScript.ts index 6bb6f831..4e9f5cfd 100644 --- a/modules/motions/hooks/useContractEvmScript.ts +++ b/modules/motions/hooks/useContractEvmScript.ts @@ -28,6 +28,9 @@ import { ContractStethRewardProgramAdd, ContractStethRewardProgramRemove, ContractStethRewardProgramTopUp, + ContractStethGasSupplyAdd, + ContractStethGasSupplyRemove, + ContractStethGasSupplyTopUp, } from 'modules/blockChain/contracts' import { EvmUnrecognized } from '../evmAddresses' @@ -60,6 +63,9 @@ export const EVM_CONTRACTS = { [MotionType.StethRewardProgramAdd]: ContractStethRewardProgramAdd, [MotionType.StethRewardProgramRemove]: ContractStethRewardProgramRemove, [MotionType.StethRewardProgramTopUp]: ContractStethRewardProgramTopUp, + [MotionType.StethGasSupplyAdd]: ContractStethGasSupplyAdd, + [MotionType.StethGasSupplyRemove]: ContractStethGasSupplyRemove, + [MotionType.StethGasSupplyTopUp]: ContractStethGasSupplyTopUp, } as const export function useContractEvmScript( diff --git a/modules/motions/hooks/useEVMScriptDecoder.ts b/modules/motions/hooks/useEVMScriptDecoder.ts index acab3cab..4e28ab49 100644 --- a/modules/motions/hooks/useEVMScriptDecoder.ts +++ b/modules/motions/hooks/useEVMScriptDecoder.ts @@ -4,50 +4,45 @@ import { useWeb3 } from 'modules/blockChain/hooks/useWeb3' import { EVMScriptDecoder } from '@lidofinance/evm-script-decoder/lib/EVMScriptDecoder' import { ABIProviderLocal } from '@lidofinance/evm-script-decoder/lib/ABIProviderLocal' -import ReferralPartnersRegistry from 'abi/ReferralPartnersRegistry.abi.json' -import RewardProgramRegistryAbi from 'abi/RewardProgramRegistry.abi.json' -import NodeOperatorsRegistryAbi from 'abi/NodeOperators.abi.json' -import AllowedRecipientsRegistryAbi from 'abi/newReward/AllowedRecipientsRegistry.abi.json' -import RegistryWithLimitsAbi from 'abi/TopUp/RegistryWithLimits.abi.json' -import FinanceAbi from 'abi/Finance.abi.json' -import * as CONTRACT_ADDRESSES from 'modules/blockChain/contractAddresses' +import * as abis from 'generated' +import * as ADDR from 'modules/blockChain/contractAddresses' export function useEVMScriptDecoder() { const { chainId } = useWeb3() - return useGlobalMemo( - () => - new EVMScriptDecoder( - new ABIProviderLocal({ - [CONTRACT_ADDRESSES.ReferralPartnersRegistry[chainId]]: - ReferralPartnersRegistry as any, - [CONTRACT_ADDRESSES.RewardProgramRegistry[chainId]]: - RewardProgramRegistryAbi as any, - [CONTRACT_ADDRESSES.NodeOperatorsRegistry[chainId]]: - NodeOperatorsRegistryAbi as any, - [CONTRACT_ADDRESSES.Finance[chainId]]: FinanceAbi as any, - [CONTRACT_ADDRESSES.AllowedRecipientRegistry[chainId]]: - AllowedRecipientsRegistryAbi as any, - [CONTRACT_ADDRESSES.AllowedRecipientReferralDaiRegistry[chainId]]: - AllowedRecipientsRegistryAbi as any, - [CONTRACT_ADDRESSES.AllowedRecipientTrpLdoRegistry[chainId]]: - AllowedRecipientsRegistryAbi as any, - [CONTRACT_ADDRESSES.LegoLDORegistry[chainId]]: - RegistryWithLimitsAbi as any, - [CONTRACT_ADDRESSES.LegoDAIRegistry[chainId]]: - RegistryWithLimitsAbi as any, - [CONTRACT_ADDRESSES.RccDAIRegistry[chainId]]: - RegistryWithLimitsAbi as any, - [CONTRACT_ADDRESSES.PmlDAIRegistry[chainId]]: - RegistryWithLimitsAbi as any, - [CONTRACT_ADDRESSES.AtcDAIRegistry[chainId]]: - RegistryWithLimitsAbi as any, - [CONTRACT_ADDRESSES.gasFunderETHRegistry[chainId]]: - RegistryWithLimitsAbi as any, - [CONTRACT_ADDRESSES.StethRewardProgramRegistry[chainId]]: - RegistryWithLimitsAbi as any, - }), - ), - `evm-script-decoder-${chainId}`, - ) + return useGlobalMemo(() => { + const KEYS = Object.keys(ADDR).reduce( + (keys, contractName: keyof typeof ADDR) => ({ + ...keys, + [contractName]: ADDR[contractName][chainId]!, + }), + {} as Record, + ) + + return new EVMScriptDecoder( + new ABIProviderLocal({ + [KEYS.ReferralPartnersRegistry]: abis + .ReferralPartnersRegistryAbi__factory.abi as any, + [KEYS.RewardProgramRegistry]: + abis.RewardProgramRegistryAbi__factory.abi, + [KEYS.NodeOperatorsRegistry]: abis.NodeOperatorsAbi__factory.abi, + [KEYS.Finance]: abis.FinanceAbi__factory.abi, + [KEYS.AllowedRecipientRegistry]: + abis.AllowedRecipientsRegistryAbi__factory.abi, + [KEYS.AllowedRecipientReferralDaiRegistry]: + abis.AllowedRecipientsRegistryAbi__factory.abi, + [KEYS.AllowedRecipientTrpLdoRegistry]: + abis.AllowedRecipientsRegistryAbi__factory.abi, + [KEYS.LegoLDORegistry]: abis.RegistryWithLimitsAbi__factory.abi, + [KEYS.LegoDAIRegistry]: abis.RegistryWithLimitsAbi__factory.abi, + [KEYS.RccDAIRegistry]: abis.RegistryWithLimitsAbi__factory.abi, + [KEYS.PmlDAIRegistry]: abis.RegistryWithLimitsAbi__factory.abi, + [KEYS.AtcDAIRegistry]: abis.RegistryWithLimitsAbi__factory.abi, + [KEYS.gasFunderETHRegistry]: abis.RegistryWithLimitsAbi__factory.abi, + [KEYS.StethRewardProgramRegistry]: + abis.RegistryWithLimitsAbi__factory.abi, + [KEYS.StethGasSupplyRegistry]: abis.RegistryWithLimitsAbi__factory.abi, + }), + ) + }, `evm-script-decoder-${chainId}`) } diff --git a/modules/motions/hooks/useLegoTokenOptions.ts b/modules/motions/hooks/useLegoTokenOptions.ts index 6d9a495a..00ef4f39 100644 --- a/modules/motions/hooks/useLegoTokenOptions.ts +++ b/modules/motions/hooks/useLegoTokenOptions.ts @@ -14,15 +14,15 @@ export function useLegoTokenOptions() { }, { label: governanceSymbol || '', - value: CONTRACT_ADDRESSES.GovernanceToken[chainId], + value: CONTRACT_ADDRESSES.GovernanceToken[chainId]!, }, { label: 'stETH', - value: CONTRACT_ADDRESSES.STETH[chainId], + value: CONTRACT_ADDRESSES.STETH[chainId]!, }, { label: 'DAI', - value: CONTRACT_ADDRESSES.DAI[chainId], + value: CONTRACT_ADDRESSES.DAI[chainId]!, }, ], [governanceSymbol, chainId], diff --git a/modules/motions/hooks/useRegistryWithLimits.ts b/modules/motions/hooks/useRegistryWithLimits.ts index 95c09481..a504af85 100644 --- a/modules/motions/hooks/useRegistryWithLimits.ts +++ b/modules/motions/hooks/useRegistryWithLimits.ts @@ -12,6 +12,7 @@ import { ContractAllowedRecipientReferralDaiRegistry, ContractAllowedRecipientTrpLdoRegistry, ContractStethRewardProgramRegistry, + ContractStethGasSupplyRegistry, } from 'modules/blockChain/contracts' import { getEventsRecipientAdded } from 'modules/motions/utils' import { MotionType } from 'modules/motions/types' @@ -44,6 +45,9 @@ export const REGISTRY_WITH_LIMITS_BY_MOTION_TYPE = { [MotionType.StethRewardProgramAdd]: ContractStethRewardProgramRegistry, [MotionType.StethRewardProgramRemove]: ContractStethRewardProgramRegistry, [MotionType.StethRewardProgramTopUp]: ContractStethRewardProgramRegistry, + [MotionType.StethGasSupplyAdd]: ContractStethGasSupplyRegistry, + [MotionType.StethGasSupplyRemove]: ContractStethGasSupplyRegistry, + [MotionType.StethGasSupplyTopUp]: ContractStethGasSupplyRegistry, } type HookArgs = { diff --git a/modules/motions/hooks/useTokenByTopUpType.ts b/modules/motions/hooks/useTokenByTopUpType.ts index cbf84052..b4e7895f 100644 --- a/modules/motions/hooks/useTokenByTopUpType.ts +++ b/modules/motions/hooks/useTokenByTopUpType.ts @@ -80,7 +80,7 @@ export const useTokenByTopUpType = ({ if (!isTopUpType(registryType)) return { label: '', address: '' } const label = TOKEN[registryType].label - const address = TOKEN[registryType].value(chainId) + const address = TOKEN[registryType].value(chainId)! return { label, address } } diff --git a/modules/motions/types.ts b/modules/motions/types.ts index 56318641..262cd065 100644 --- a/modules/motions/types.ts +++ b/modules/motions/types.ts @@ -5,11 +5,24 @@ import type { EasyTrackAbi } from 'generated' export const MotionType = { NodeOperatorIncreaseLimit: 'NodeOperatorIncreaseLimit', LEGOTopUp: 'LEGOTopUp', - // @deprecated + AllowedRecipientTopUpTrpLdo: 'AllowedRecipientTopUpTrpLdo', + LegoLDOTopUp: 'LegoLDOTopUp', + LegoDAITopUp: 'LegoDAITopUp', + RccDAITopUp: 'RccDAITopUp', + PmlDAITopUp: 'PmlDAITopUp', + AtcDAITopUp: 'AtcDAITopUp', + GasFunderETHTopUp: 'GasFunderETHTopUp', + StethRewardProgramAdd: 'StethRewardProgramAdd', + StethRewardProgramRemove: 'StethRewardProgramRemove', + StethRewardProgramTopUp: 'StethRewardProgramTopUp', + StethGasSupplyAdd: 'StethGasSupplyAdd', + StethGasSupplyRemove: 'StethGasSupplyRemove', + StethGasSupplyTopUp: 'StethGasSupplyTopUp', + + // next motion types are retired + // we are keeping them here to display history data RewardProgramAdd: 'RewardProgramAdd', - // @deprecated RewardProgramRemove: 'RewardProgramRemove', - // @deprecated RewardProgramTopUp: 'RewardProgramTopUp', ReferralPartnerAdd: 'ReferralPartnerAdd', ReferralPartnerRemove: 'ReferralPartnerRemove', @@ -20,21 +33,34 @@ export const MotionType = { AllowedRecipientAddReferralDai: 'AllowedRecipientAddReferralDai', AllowedRecipientRemoveReferralDai: 'AllowedRecipientRemoveReferralDai', AllowedRecipientTopUpReferralDai: 'AllowedRecipientTopUpReferralDai', - AllowedRecipientTopUpTrpLdo: 'AllowedRecipientTopUpTrpLdo', - LegoLDOTopUp: 'LegoLDOTopUp', - LegoDAITopUp: 'LegoDAITopUp', - RccDAITopUp: 'RccDAITopUp', - PmlDAITopUp: 'PmlDAITopUp', - AtcDAITopUp: 'AtcDAITopUp', - GasFunderETHTopUp: 'GasFunderETHTopUp', - StethRewardProgramAdd: 'StethRewardProgramAdd', - StethRewardProgramRemove: 'StethRewardProgramRemove', - StethRewardProgramTopUp: 'StethRewardProgramTopUp', } as const // intentionally // eslint-disable-next-line @typescript-eslint/no-redeclare export type MotionType = typeof MotionType[keyof typeof MotionType] +// Only motions currently supported to start +export const MotionTypeForms = { + NodeOperatorIncreaseLimit: MotionType.NodeOperatorIncreaseLimit, + LEGOTopUp: MotionType.LEGOTopUp, + AllowedRecipientTopUpTrpLdo: MotionType.AllowedRecipientTopUpTrpLdo, + LegoLDOTopUp: MotionType.LegoLDOTopUp, + LegoDAITopUp: MotionType.LegoDAITopUp, + RccDAITopUp: MotionType.RccDAITopUp, + PmlDAITopUp: MotionType.PmlDAITopUp, + AtcDAITopUp: MotionType.AtcDAITopUp, + GasFunderETHTopUp: MotionType.GasFunderETHTopUp, + StethRewardProgramAdd: MotionType.StethRewardProgramAdd, + StethRewardProgramRemove: MotionType.StethRewardProgramRemove, + StethRewardProgramTopUp: MotionType.StethRewardProgramTopUp, + StethGasSupplyAdd: MotionType.StethGasSupplyAdd, + StethGasSupplyRemove: MotionType.StethGasSupplyRemove, + StethGasSupplyTopUp: MotionType.StethGasSupplyTopUp, +} as const +// intentionally +// eslint-disable-next-line @typescript-eslint/no-redeclare +export type MotionTypeForms = + typeof MotionTypeForms[keyof typeof MotionTypeForms] + export const MotionStatus = { ACTIVE: 'ACTIVE', PENDING: 'PENDING', diff --git a/modules/motions/ui/MotionDescription/MotionDescription.tsx b/modules/motions/ui/MotionDescription/MotionDescription.tsx index 1fa7c8e3..17ac1533 100644 --- a/modules/motions/ui/MotionDescription/MotionDescription.tsx +++ b/modules/motions/ui/MotionDescription/MotionDescription.tsx @@ -143,6 +143,27 @@ const MOTION_DESCRIPTIONS = { registryType={MotionType.StethRewardProgramTopUp} /> ), + + [MotionType.StethGasSupplyAdd]: (props: DescAllowedRecipientAddProps) => ( + + ), + [MotionType.StethGasSupplyRemove]: ( + props: DescAllowedRecipientRemoveProps, + ) => ( + + ), + [MotionType.StethGasSupplyTopUp]: (props: DescWithLimitsProps) => ( + + ), } as const type Props = { diff --git a/modules/motions/ui/MotionFormComplete/MotionFormComplete.tsx b/modules/motions/ui/MotionFormComplete/MotionFormComplete.tsx index be7131e1..f5ece24f 100644 --- a/modules/motions/ui/MotionFormComplete/MotionFormComplete.tsx +++ b/modules/motions/ui/MotionFormComplete/MotionFormComplete.tsx @@ -28,10 +28,7 @@ type BodySafeProps = { // Can be improved with https://safe-transaction.rinkeby.gnosis.io/ function BodySafe({ tx }: BodySafeProps) { const { walletAddress } = useWeb3() - const openGnosis = useGnosisOpener( - String(walletAddress), - `/transactions/tx?id=multisig_${String(walletAddress)}_${tx.safeTxHash}`, - ) + const openGnosis = useGnosisOpener(String(walletAddress), tx.safeTxHash) return (
diff --git a/modules/motions/ui/MotionFormStartNew/MotionFormStartNew.tsx b/modules/motions/ui/MotionFormStartNew/MotionFormStartNew.tsx index f880f8f3..759b6b25 100644 --- a/modules/motions/ui/MotionFormStartNew/MotionFormStartNew.tsx +++ b/modules/motions/ui/MotionFormStartNew/MotionFormStartNew.tsx @@ -1,7 +1,7 @@ import { useCallback, useEffect, useState } from 'react' import { useForm } from 'react-hook-form' import { useWeb3 } from 'modules/blockChain/hooks/useWeb3' -import { useAvailableMotions, HIDDEN_MOTIONS } from 'modules/motions/hooks' +import { useAvailableMotions } from 'modules/motions/hooks' import { useSendTransactionGnosisWorkaround } from 'modules/blockChain/hooks/useSendTransactionGnosisWorkaround' import { Button, ToastError } from '@lidofinance/lido-ui' @@ -12,13 +12,13 @@ import { Fieldset, RetryHint, MessageBox } from './CreateMotionFormStyle' import { formParts, FormData, getDefaultFormPartsData } from './Parts' import { ContractEasyTrack } from 'modules/blockChain/contracts' -import { MotionType } from 'modules/motions/types' import { getScriptFactoryByMotionType, getMotionTypeDisplayName, } from 'modules/motions/utils' import { ResultTx } from 'modules/blockChain/types' import { getErrorMessage } from 'modules/shared/utils/getErrorMessage' +import { MotionTypeForms } from 'modules/motions/types' type Props = { onComplete: (tx: ResultTx) => void @@ -96,24 +96,22 @@ export function MotionFormStartNew({ onComplete }: Props) { ) if (!availableMotions) return - if (notHaveAvailableMotions) + if (notHaveAvailableMotions) { return ( Only Trusted Callers & Node Operator have access to Easy Track motion creation ) + } return (
- {Object.values(MotionType) - .filter( - motion => - !HIDDEN_MOTIONS.includes(motion) && availableMotions[motion], - ) - .map(type => ( + {Object.values(MotionTypeForms) + .filter(motion => Boolean(availableMotions[motion])) + .map((type: MotionTypeForms) => (