-
Notifications
You must be signed in to change notification settings - Fork 12k
Add non-value types in EnumerableSet and EnumerableMap #5658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add non-value types in EnumerableSet and EnumerableMap #5658
Conversation
🦋 Changeset detectedLatest commit: 326c466 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
f1ae7d6
to
80edba8
Compare
29c48d9
to
6508e9b
Compare
ba06447
to
e412bd9
Compare
The reason for the name But since we are moving the code from community to here, we should put all that in the existing library and not create new ones. |
Note: this is actually very close to #5558 that was closed when we decided to put these structs in the community repo. |
.flatMap((keyType, _, array) => array.map(valueType => ({ key: { type: keyType }, value: { type: valueType } }))) | ||
.slice(0, -1), // remove bytes32 → bytes32 (last one) that is already defined | ||
// non-value type maps | ||
{ key: { type: 'bytes', memory: true }, value: { type: 'uint256' } }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want to keep this one ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah, let's remove it and just keep bytes
to bytes
for now given is the most generic version.
We could theoretically do all variants for ['uint256', 'address', 'bytes32', 'bytes', 'string']
, but I think it needs more thought.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, as you mentioned in #5558, Bytes -> Uint would be useful for weights:
BytesToUintMap (usefull for something like an ERC-7093 contract for guardian->weight)
However, weights are just tracked with a mapping in the current SignerMultiERC7913Weighted and equivalent ERC7579MultisigWeighted module.
// Mapping from signer to weight
mapping(bytes signer => uint256) private _weights;
Co-authored-by: Hadrien Croubois <[email protected]>
Check #5663 before
PR Checklist
npx changeset add
)