Skip to content

Commit

Permalink
chore: retiring obsolete motion creation forms
Browse files Browse the repository at this point in the history
  • Loading branch information
manneredboor committed Jul 3, 2023
1 parent ea3b6d0 commit 6660804
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 249 deletions.
10 changes: 5 additions & 5 deletions modules/motions/evmAddresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,13 @@ export const EvmAddressesByChain = {
[CHAINS.Mainnet]: {
[MotionType.NodeOperatorIncreaseLimit]:
'0xFeBd8FAC16De88206d4b18764e826AF38546AfE0',
[MotionType.LEGOTopUp]: '0x648C8Be548F43eca4e482C0801Ebccccfb944931',
[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]:
Expand All @@ -37,6 +34,9 @@ export const EvmAddressesByChain = {

// next motion factories are @deprecated
// we are keeping them here to display history data
[MotionType.LEGOTopUp]: '0x648C8Be548F43eca4e482C0801Ebccccfb944931',
[MotionType.GasFunderETHTopUp]:
'0x41F9daC5F89092dD6061E59578A2611849317dc8',
[MotionType.RewardProgramAdd]: '0x9D15032b91d01d5c1D940eb919461426AB0dD4e3',
[MotionType.RewardProgramRemove]:
'0xc21e5e72Ffc223f02fC410aAedE3084a63963932',
Expand Down Expand Up @@ -66,15 +66,13 @@ export const EvmAddressesByChain = {
[CHAINS.Goerli]: {
[MotionType.NodeOperatorIncreaseLimit]:
'0xE033673D83a8a60500BcE02aBd9007ffAB587714',
[MotionType.LEGOTopUp]: '0xb2bcf211F103d7F13789394DD475c2274e044C4C',
[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]:
Expand All @@ -90,6 +88,8 @@ export const EvmAddressesByChain = {

// next motion factories are @deprecated
// we are keeping them here to display history data
[MotionType.LEGOTopUp]: '0xb2bcf211F103d7F13789394DD475c2274e044C4C',
[MotionType.GasFunderETHTopUp]: '0x',
[MotionType.RewardProgramAdd]: '0x5560d40b00EA3a64E9431f97B3c79b04e0cdF6F2',
[MotionType.RewardProgramRemove]:
'0x31B68d81125E52fE1aDfe4076F8945D1014753b5',
Expand Down
2 changes: 1 addition & 1 deletion modules/motions/hooks/useRegistryWithLimits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const REGISTRY_WITH_LIMITS_BY_MOTION_TYPE = {
[MotionType.StethGasSupplyAdd]: ContractStethGasSupplyRegistry,
[MotionType.StethGasSupplyRemove]: ContractStethGasSupplyRegistry,
[MotionType.StethGasSupplyTopUp]: ContractStethGasSupplyRegistry,
}
} as const

type HookArgs = {
registryType: keyof typeof REGISTRY_WITH_LIMITS_BY_MOTION_TYPE
Expand Down
8 changes: 2 additions & 6 deletions modules/motions/providers/motionDetailed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
getMotionTypeByScriptFactory,
getMotionTypeDisplayName,
getEventMotionCreated,
getContractMethodParams,
estimateGasFallback,
} from 'modules/motions/utils'
import {
Expand Down Expand Up @@ -130,20 +129,17 @@ export const MotionDetailedProvider: FC<MotionDetailedProps> = props => {
motion.id,
)
const gasLimit = await estimateGasFallback(
contractEasyTrack.estimateGas.enactMotion(motion.id, _callData, {
...getContractMethodParams(motion.evmScriptFactory, 'enact'),
}),
contractEasyTrack.estimateGas.enactMotion(motion.id, _callData),
)
const tx = await contractEasyTrack.populateTransaction.enactMotion(
motion.id,
_callData,
{
gasLimit,
...getContractMethodParams(motion.evmScriptFactory, 'enact'),
},
)
return tx
}, [contractEasyTrack, motion.evmScriptFactory, motion.id])
}, [contractEasyTrack, motion.id])

const txEnact = useTransactionSender(populateEnact, {
onFinish: onInvalidate,
Expand Down
43 changes: 18 additions & 25 deletions modules/motions/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,32 @@ import type { BigNumber } from 'ethers'
import type { PromiseValue } from 'type-fest'
import type { EasyTrackAbi } from 'generated'

export const MotionType = {
// Only motions currently supported to start
export const MotionTypeForms = {
NodeOperatorIncreaseLimit: 'NodeOperatorIncreaseLimit',
LEGOTopUp: 'LEGOTopUp',
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',
} as const
// intentionally
// eslint-disable-next-line @typescript-eslint/no-redeclare
export type MotionTypeForms =
typeof MotionTypeForms[keyof typeof MotionTypeForms]

// next motion types are retired
// we are keeping them here to display history data
// next motion types are retired
// we are keeping them here to display history data
export const MotionTypeDisplayOnly = {
LEGOTopUp: 'LEGOTopUp',
GasFunderETHTopUp: 'GasFunderETHTopUp',
RewardProgramAdd: 'RewardProgramAdd',
RewardProgramRemove: 'RewardProgramRemove',
RewardProgramTopUp: 'RewardProgramTopUp',
Expand All @@ -36,30 +43,16 @@ export const MotionType = {
} as const
// intentionally
// eslint-disable-next-line @typescript-eslint/no-redeclare
export type MotionType = typeof MotionType[keyof typeof MotionType]
export type MotionTypeDisplayOnly =
typeof MotionTypeDisplayOnly[keyof typeof MotionTypeDisplayOnly]

// 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,
export const MotionType = {
...MotionTypeForms,
...MotionTypeDisplayOnly,
} as const
// intentionally
// eslint-disable-next-line @typescript-eslint/no-redeclare
export type MotionTypeForms =
typeof MotionTypeForms[keyof typeof MotionTypeForms]
export type MotionType = typeof MotionType[keyof typeof MotionType]

export const MotionStatus = {
ACTIVE: 'ACTIVE',
Expand Down
170 changes: 0 additions & 170 deletions modules/motions/ui/MotionFormStartNew/Parts/StartNewLEGO.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions modules/motions/ui/MotionFormStartNew/Parts/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { MotionTypeForms } from 'modules/motions/types'

import * as formNodeOperators from './StartNewNodeOperators'
import * as formLEGO from './StartNewLEGO'
import * as formAllowedRecipientAdd from './StartNewAllowedRecipientAdd'
import * as formAllowedRecipientRemove from './StartNewAllowedRecipientRemove'
import * as formAllowedRecipientTopUp from './StartNewAllowedRecipientTopUp'
import * as StartNewTopUpWithLimits from './StartNewTopUpWithLimits'

export const formParts = {
[MotionTypeForms.NodeOperatorIncreaseLimit]: formNodeOperators.formParts,
[MotionTypeForms.LEGOTopUp]: formLEGO.formParts,
[MotionTypeForms.AllowedRecipientTopUpTrpLdo]:
formAllowedRecipientTopUp.formParts({
registryType: MotionTypeForms.AllowedRecipientTopUpTrpLdo,
Expand All @@ -29,9 +27,6 @@ export const formParts = {
[MotionTypeForms.AtcDAITopUp]: StartNewTopUpWithLimits.formParts({
registryType: MotionTypeForms.AtcDAITopUp,
}),
[MotionTypeForms.GasFunderETHTopUp]: StartNewTopUpWithLimits.formParts({
registryType: MotionTypeForms.GasFunderETHTopUp,
}),
[MotionTypeForms.StethRewardProgramAdd]: formAllowedRecipientAdd.formParts({
registryType: MotionTypeForms.StethRewardProgramAdd,
}),
Expand Down
34 changes: 0 additions & 34 deletions modules/motions/utils/getContractMethodParams.ts

This file was deleted.

Loading

0 comments on commit 6660804

Please sign in to comment.