You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This ERC specifies that the key is a string type and the value is bytes type. This provides flexibility for storing any type of data while maintaining an intuitive string-based key interface.
56
56
57
+
### Optional Diamond Storage
58
+
59
+
Contracts implementing this ERC MAY use Diamond Storage pattern for predictable storage locations. If implemented, contracts MUST use the namespace ID `"erc8048.onchain.metadata.storage"`.
60
+
61
+
The Diamond Storage pattern provides predictable storage locations for data, which is useful for cross-chain applications using inclusion proofs. For more details on Diamond Storage, see ERC-8042.
62
+
57
63
### Examples
58
64
59
65
The inspiration for this standard was trustless AI agents. The registry extends ERC-721 by adding getMetadata and setMetadata functions for optional extra on-chain agent metadata.
@@ -89,11 +95,13 @@ This design prioritizes simplicity and flexibility by using a string-key, bytes-
89
95
90
96
## Reference Implementation
91
97
92
-
The interface is defined in the Required Metadata Function and Event section above. Here is a reference implementation:
98
+
The interface is defined in the Required Metadata Function and Event section above. Here are reference implementations:
99
+
100
+
### Basic Implementation
93
101
94
102
```solidity
95
103
// SPDX-License-Identifier: MIT
96
-
pragma solidity ^0.8.0;
104
+
pragma solidity ^0.8.25;
97
105
98
106
import "./IOnchainMetadata.sol";
99
107
@@ -116,12 +124,53 @@ contract OnchainMetadataExample is IOnchainMetadata {
116
124
}
117
125
```
118
126
127
+
### Diamond Storage Implementation
128
+
129
+
```solidity
130
+
// SPDX-License-Identifier: MIT
131
+
pragma solidity ^0.8.20;
132
+
133
+
import "./IOnchainMetadata.sol";
134
+
135
+
contract OnchainMetadataDiamondExample is IOnchainMetadata {
0 commit comments