Add new EnumerableMap types (#4843)
Co-authored-by: ernestognw <ernestognw@gmail.com>
This commit is contained in:
@ -36,6 +36,10 @@ import {EnumerableSet} from "./EnumerableSet.sol";
|
||||
* - \`bytes32 -> bytes32\` (\`Bytes32ToBytes32Map\`) since v4.6.0
|
||||
* - \`uint256 -> uint256\` (\`UintToUintMap\`) since v4.7.0
|
||||
* - \`bytes32 -> uint256\` (\`Bytes32ToUintMap\`) since v4.7.0
|
||||
* - \`uint256 -> bytes32\` (\`UintToBytes32Map\`) since v5.1.0
|
||||
* - \`address -> address\` (\`AddressToAddressMap\`) since v5.1.0
|
||||
* - \`address -> bytes32\` (\`AddressToBytes32Map\`) since v5.1.0
|
||||
* - \`bytes32 -> address\` (\`Bytes32ToAddressMap\`) since v5.1.0
|
||||
*
|
||||
* [WARNING]
|
||||
* ====
|
||||
|
||||
@ -8,12 +8,10 @@ const formatType = (keyType, valueType) => ({
|
||||
valueType,
|
||||
});
|
||||
|
||||
const TYPES = [
|
||||
['uint256', 'uint256'],
|
||||
['uint256', 'address'],
|
||||
['address', 'uint256'],
|
||||
['bytes32', 'uint256'],
|
||||
].map(args => formatType(...args));
|
||||
const TYPES = ['uint256', 'address', 'bytes32']
|
||||
.flatMap((key, _, array) => array.map(value => [key, value]))
|
||||
.slice(0, -1) // remove bytes32 → byte32 (last one) that is already defined
|
||||
.map(args => formatType(...args));
|
||||
|
||||
module.exports = {
|
||||
TYPES,
|
||||
|
||||
Reference in New Issue
Block a user