Skip to content

Commit

Permalink
add chain version check
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahSaso committed Nov 9, 2024
1 parent 18c5729 commit 7c8593f
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
getRewardDistributionKey,
parseContractVersion,
tokenToUncheckedDenom,
versionGte,
} from '@dao-dao/utils'

import { useQueryLoadingDataWithError } from '../../../../hooks'
Expand Down Expand Up @@ -96,6 +97,19 @@ export class FixRewardDistributorAction extends ActionBase<FixRewardDistributorD
if (options.context.type !== ActionContextType.Dao) {
throw new Error('Only DAOs can setup reward distributions')
}
if (options.chainContext.type !== ActionChainContextType.Supported) {
throw new Error('Unsupported chain')
}

// Reward distributor is fixed in v2.6.0.
if (
!versionGte(
options.chainContext.config.latestVersion,
ContractVersion.V260
)
) {
throw new Error('Unsupported chain version')
}

super(options, {
Icon: WrenchEmoji,
Expand Down

0 comments on commit 7c8593f

Please sign in to comment.