Skip to content

Commit

Permalink
Update ERC-7578: Update getter and setter methods naming
Browse files Browse the repository at this point in the history
Merged by EIP-Bot.
  • Loading branch information
V1d0r authored Oct 8, 2024
1 parent 610506a commit 1526cba
Showing 1 changed file with 7 additions and 7 deletions.
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

0 comments on commit 1526cba

Please sign in to comment.