-
Notifications
You must be signed in to change notification settings - Fork 841
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
Does ERC721A work with NFT changing name? #375
Comments
Yes! function _setStringAtStorageSlot(string memory value, uint256 storageSlot) private {
assembly {
let stringLength := mload(value)
switch gt(stringLength, 0x1F)
case 0 {
sstore(storageSlot, or(mload(add(value, 0x20)), mul(stringLength, 2)))
}
default {
sstore(storageSlot, add(mul(stringLength, 2), 1))
mstore(0x00, storageSlot)
let dataSlot := keccak256(0x00, 0x20)
for { let i := 0 } lt(mul(i, 0x20), stringLength) { i := add(i, 0x01) } {
sstore(add(dataSlot, i), mload(add(value, mul(add(i, 1), 0x20))))
}
}
}
}
function setName(string memory value) public {
_setStringAtStorageSlot(value, 2);
}
function setSymbol(string memory value) public {
_setStringAtStorageSlot(value, 3);
} This is only for the regular ERC721A (non-upgradeable version), and make sure Make sure to add an Another way is to simply override the |
@Vectorized this code lets the owner of the NFT change its name? |
Please make sure that you use the |
@Vectorized I understand, but will this function let the owner of the NFT change their NFT name? Like The SHIBOSHIS? |
No. That’s |
Just wanted to say thank you for providing this code! Super helpful! |
No description provided.
The text was updated successfully, but these errors were encountered: