Skip to content
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

Update getter and setter methods naming #11

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions ERCS/erc-7578.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,15 @@ interface IERC7578 {
* @dev Does NOT revert if token doesn't exist
* @param tokenId The token ID of the minted token
*/
function getProperties(uint256 tokenId) external view returns (Properties memory properties);
function getPropertiesOf(uint256 tokenId) external view returns (Properties memory properties);
}
```

When `properties` are set, the `PropertiesSet(uint256 indexed tokenId, Properties properties)` event is emitted.

When `properties` are removed, the `PropertiesRemoved(uint256 indexed tokenId)` event is emitted.

The `getProperties(uint256 tokenId)` function MUST return the unique `properties` of a token. If the ERC-721 token is burned or has no properties set, it SHOULD return an empty `Properties` struct.
The `getPropertiesOf(uint256 tokenId)` function MUST return the unique `properties` of a token. If the ERC-721 token is burned or has no properties set, it SHOULD return an empty `Properties` struct.

## Rationale

Expand Down Expand Up @@ -158,7 +158,7 @@ contract ERC7578 is ERC721, IERC7578 {
/**
* @inheritdoc IERC7578
*/
function getProperties(uint256 tokenId) public view override returns (Properties memory properties) {
function getPropertiesOf(uint256 tokenId) public view override returns (Properties memory properties) {
properties = _properties[tokenId];
}

Expand All @@ -172,7 +172,7 @@ contract ERC7578 is ERC721, IERC7578 {
*
* Emits a {PropertiesSet} event
*/
function _setProperties(uint256 tokenId, Properties calldata properties) internal {
function _setPropertiesOf(uint256 tokenId, Properties calldata properties) internal {
_properties[tokenId] = Properties({
tokenIssuer: properties.tokenIssuer,
assetHolder: properties.assetHolder,
Expand All @@ -194,7 +194,7 @@ contract ERC7578 is ERC721, IERC7578 {
*
* Emits a {PropertiesRemoved} event
*/
function _removeProperties(uint256 tokenId) internal {
function _removePropertiesOf(uint256 tokenId) internal {
delete _properties[tokenId];
emit PropertiesRemoved(tokenId);
}
Expand All @@ -207,7 +207,7 @@ contract ERC7578 is ERC721, IERC7578 {
function _update(address to, uint256 tokenId, address auth) internal virtual override returns (address) {
address from = _ownerOf(tokenId);
if (to == address(0)) {
_removeProperties(tokenId);
_removePropertiesOf(tokenId);
} else if (from == address(0)) {
if (bytes(_properties[tokenId].tokenIssuer).length == 0) revert PropertiesUninitialized();
}
Expand All @@ -219,7 +219,7 @@ contract ERC7578 is ERC721, IERC7578 {

## Security Considerations

To ensure the authenticity of a token's properties, the `_setProperties()` method should only be called inside a method that is restricted to a trusted Externally Owned Account (EOA) or contract. This trusted entity must verify that the properties accurately reflect the real physical attributes of the token.
To ensure the authenticity of a token's properties, the `_setPropertiesOf()` method should only be called inside a method that is restricted to a trusted Externally Owned Account (EOA) or contract. This trusted entity must verify that the properties accurately reflect the real physical attributes of the token.

## Copyright

Expand Down