Skip to content

Commit

Permalink
Update EIP-7015: eip 7015
Browse files Browse the repository at this point in the history
Merged by EIP-Bot.
  • Loading branch information
cf authored Jul 27, 2023
1 parent adad596 commit bf74be7
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions EIPS/eip-7015.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ Creator consent is given by signing an [EIP-712](./eip-712.md) compatible mess

```solidity
struct TokenCreation {
bytes32 params;
bytes32 structHash;
}
```

Where `params` represent the hashed data used to deploy the NFT.
Where `structHash` represent the hashed data used to deploy the NFT.

**Signature Validation**

Creator attribution is given through a signature verification that MUST be verified by the NFT contract being deployed and an event that MUST be emitted by the NFT contract during the deployment transaction. The event includes all the necessary fields for reconstructing the signed digest and validating the signature to ensure it matches the specified creator. The event name is `CreatorAttribution` and includes the following fields:

- `params`: hashed information for deploying the NFT contract (e.g. name, symbol, admins etc)
- `structHash`: hashed information for deploying the NFT contract (e.g. name, symbol, admins etc)
- `domainName`: the domain name of the contract verifying the singature (for EIP-712 signature validation)
- `version`: the version of the contract verifying the signature (for EIP-712 signature validation)
- `signature`: the creator’s signature
Expand All @@ -52,7 +52,7 @@ The event is defined as follows:

```solidity
event CreatorAttribution(
bytes32 params,
bytes32 structHash,
string domainName,
string version,
bytes signature
Expand All @@ -78,7 +78,7 @@ abstract contract ERC7015 is EIP712 {
error Invalid_Signature();
event CreatorAttribution(
bytes32 params,
bytes32 structHash,
string domainName,
string version,
bytes signature
Expand All @@ -90,38 +90,38 @@ abstract contract ERC7015 is EIP712 {
bytes32 public constant TYPEHASH =
keccak256(
"CreatorAttribution(bytes32 params)"
"CreatorAttribution(bytes32 structHash)"
);
constructor() EIP712("ERC7015", "1") {}
function _validateSignature(
string memory name,
string memory symbol,
bytes32 params,
bytes32 structHash,
address creator,
bytes memory signature
) internal {
if (!_isValid(params, creator, signature))
if (!_isValid(structHash, creator, signature))
revert Invalid_Signature();
emit CreatorAttribution(
params,
structHash,
"ERC7015",
"1",
signature
);
}
function _isValid(
bytes32 params,
bytes32 structHash,
address signer,
bytes memory signature
) internal view returns (bool) {
require(signer != address(0), "cannot validate");
bytes32 digest = _hashTypedDataV4(
keccak256(abi.encode(TYPEHASH, params, token))
keccak256(abi.encode(TYPEHASH, structHash, token))
);
if (signer.code.length != 0) {
Expand Down

0 comments on commit bf74be7

Please sign in to comment.