Refactor EnumerableSet generation and tests (#4762)
This commit is contained in:
@ -1,11 +1,6 @@
|
||||
const format = require('../format-lines');
|
||||
const { fromBytes32, toBytes32 } = require('./conversion');
|
||||
|
||||
const TYPES = [
|
||||
{ name: 'Bytes32Set', type: 'bytes32' },
|
||||
{ name: 'AddressSet', type: 'address' },
|
||||
{ name: 'UintSet', type: 'uint256' },
|
||||
];
|
||||
const { TYPES } = require('./EnumerableSet.opts');
|
||||
|
||||
/* eslint-disable max-len */
|
||||
const header = `\
|
||||
|
||||
10
scripts/generate/templates/EnumerableSet.opts.js
Normal file
10
scripts/generate/templates/EnumerableSet.opts.js
Normal file
@ -0,0 +1,10 @@
|
||||
const mapType = str => (str == 'uint256' ? 'Uint' : `${str.charAt(0).toUpperCase()}${str.slice(1)}`);
|
||||
|
||||
const formatType = type => ({
|
||||
name: `${mapType(type)}Set`,
|
||||
type,
|
||||
});
|
||||
|
||||
const TYPES = ['bytes32', 'address', 'uint256'].map(formatType);
|
||||
|
||||
module.exports = { TYPES, formatType };
|
||||
Reference in New Issue
Block a user