From 27139ebf335b152fce8bdaafd2308c476e03f27c Mon Sep 17 00:00:00 2001 From: bowd Date: Sun, 18 Aug 2024 21:08:52 +0200 Subject: [PATCH] docs: add more comments to generator script --- bin/gen-array-helpers.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/bin/gen-array-helpers.ts b/bin/gen-array-helpers.ts index a7fdacb..3e0645e 100644 --- a/bin/gen-array-helpers.ts +++ b/bin/gen-array-helpers.ts @@ -6,15 +6,10 @@ import fs from 'fs'; -const HEADER = ` -// AUTOGENERATED FILE (bin/gen-array-helpers.ts) DON'T MODIFY DIRECTLY -// SPDX-License-Identifier: GPL-3.0-or-later -pragma solidity <0.9.0; -` - +// @dev Add more types to the TARGETS object to generate more functions const TARGETS = { - uints: { - type: "uint256" + uints: { // function name + type: "uint256" // type }, addresses: { type: 'address' @@ -26,8 +21,16 @@ const TARGETS = { type: 'bytes32' } } as const; +// @dev MAX_SIZE controls the maximum size of the array that can be generated +// the script will create overloaded functions with 1 to MAX_SIZE arguments. const MAX_SIZE = 8; +const HEADER = ` +// AUTOGENERATED FILE (bin/gen-array-helpers.ts) DON'T MODIFY DIRECTLY +// SPDX-License-Identifier: GPL-3.0-or-later +pragma solidity ^0.8; +` + const templateFnAssignments = (size: number): string => { let content = ''; for (let j = 0; j < size; j++) {