-
Notifications
You must be signed in to change notification settings - Fork 40
Move contractURI() to extension
#310
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
Draft
arr00
wants to merge
5
commits into
master
Choose a base branch
from
chore/erc7984-metadata-extension
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f7b38a7
Move `contractIURI()` to extension
arr00 89c4dde
remove incorrect comment
arr00 f317bc0
add `_setContractURI` internal function
arr00 3176273
rename `ERC7984ContractURI` to `ERC7984ContractURI`
arr00 75906f1
add extension to docs
arr00 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| // SPDX-License-Identifier: MIT | ||
|
|
||
| pragma solidity ^0.8.24; | ||
|
|
||
| import {IERC7984} from "./IERC7984.sol"; | ||
|
|
||
| /// @dev Interface for the optional {contractURI} function for {IERC7984}. | ||
| interface IERC7984ContractURI is IERC7984 { | ||
| /// @dev Returns the contract URI. Should be formatted as described in https://eips.ethereum.org/EIPS/eip-7572[ERC-7572]. | ||
| function contractURI() external view returns (string memory); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| // SPDX-License-Identifier: MIT | ||
|
|
||
| pragma solidity ^0.8.27; | ||
|
|
||
| import {euint64} from "@fhevm/solidity/lib/FHE.sol"; | ||
| import {ERC7984ContractURI} from "../../token/ERC7984/extensions/ERC7984ContractURI.sol"; | ||
| import {ERC7984Mock, ERC7984} from "./ERC7984Mock.sol"; | ||
|
|
||
| contract ERC7984ContractURIMock is ERC7984ContractURI, ERC7984Mock { | ||
| constructor( | ||
| string memory name_, | ||
| string memory symbol_, | ||
| string memory contractURI_ | ||
| ) ERC7984Mock(name_, symbol_) ERC7984ContractURI(contractURI_) {} | ||
|
|
||
| function supportsInterface( | ||
| bytes4 interfaceId | ||
| ) public view virtual override(ERC7984ContractURI, ERC7984) returns (bool) { | ||
| return super.supportsInterface(interfaceId); | ||
| } | ||
|
|
||
| function _update( | ||
| address from, | ||
| address to, | ||
| euint64 amount | ||
| ) internal virtual override(ERC7984Mock, ERC7984) returns (euint64) { | ||
| return super._update(from, to, amount); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // SPDX-License-Identifier: MIT | ||
| // OpenZeppelin Confidential Contracts (token/ERC7984/extensions/ERC7984ContractURI.sol) | ||
| pragma solidity ^0.8.27; | ||
|
|
||
| import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; | ||
| import {IERC7984ContractURI} from "../../../interfaces/IERC7984ContractURI.sol"; | ||
| import {ERC7984} from "../ERC7984.sol"; | ||
|
|
||
| /** | ||
| * @dev Extension of {ERC7984} that adds a {contractURI} function. | ||
| */ | ||
| abstract contract ERC7984ContractURI is IERC7984ContractURI, ERC7984 { | ||
| /// @dev Event emitted when the contract URI is changed. | ||
| event ContractURIUpdated(); | ||
|
|
||
| string private _contractURI; | ||
|
|
||
| constructor(string memory contractURI_) { | ||
| _setContractURI(contractURI_); | ||
| } | ||
|
|
||
| /// @inheritdoc IERC7984ContractURI | ||
| function contractURI() public view virtual returns (string memory) { | ||
| return _contractURI; | ||
| } | ||
|
|
||
| /// @inheritdoc IERC165 | ||
| function supportsInterface(bytes4 interfaceId) public view virtual override(ERC7984, IERC165) returns (bool) { | ||
| return interfaceId == type(IERC7984ContractURI).interfaceId || super.supportsInterface(interfaceId); | ||
| } | ||
|
|
||
| /** | ||
| * @dev Sets the {contractURI} for the contract. | ||
| * | ||
| * Emits a {ContractURIUpdated} event. | ||
| */ | ||
| function _setContractURI(string memory newContractURI) internal virtual { | ||
| _contractURI = newContractURI; | ||
|
|
||
| emit ContractURIUpdated(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.