hardhat
Version:
Hardhat is an extensible developer tool that helps smart contract developers increase productivity by reliably bringing together the tools they want.
30 lines (23 loc) • 746 B
text/typescript
import type { NewUtilsTaskActionFunction } from "../../types.js";
import { HardhatError } from "@nomicfoundation/hardhat-errors";
import {
getIntTypeRange,
parseIntType,
} from "@nomicfoundation/hardhat-utils/abi";
interface MaxValueActionArguments {
type: string;
}
const maxValueAction: NewUtilsTaskActionFunction<
MaxValueActionArguments
> = async ({ type }) => {
const intType = parseIntType(type);
if (intType === undefined) {
throw new HardhatError(HardhatError.ERRORS.CORE.ARGUMENTS.INVALID_VALUE, {
value: type,
name: "type",
reason: "it must be a Solidity integer type, like uint256 or int128",
});
}
console.log(getIntTypeRange(intType).max.toString());
};
export default maxValueAction;