-
Notifications
You must be signed in to change notification settings - Fork 12.1k
Add interface for ERC6909 #5343
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
Merged
Merged
Changes from 17 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
1c14560
Add IERC6909
arr00 7fac687
rename file
arr00 8f49ffb
update file path
arr00 4c7bf79
Merge branch 'master' into feat/erc6909-interface
arr00 1f9f114
add changelog
arr00 fc00205
Merge branch 'master' into feat/erc6909-interface
arr00 195cb47
add file to interfaces dir
arr00 8b91f1c
move interface implementation to interfaces folder
arr00 792353a
Update .changeset/long-walls-draw.md
arr00 1189a0d
fix import
arr00 ae58067
fix path
arr00 e140c7c
Merge branch 'master' into feat/erc6909-interface
arr00 af01467
update changelog
arr00 1a037a0
add interface extensions
arr00 af3fdda
`approve` is not view
arr00 f7e895e
Fix `IERC6909ContentURI` name
arr00 8ee031d
Update contracts/interfaces/draft-IERC6909.sol
ernestognw f4ae88e
generalize `Approval` docs
arr00 96bb50a
use ERC parameters
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'openzeppelin-solidity': minor | ||
--- | ||
|
||
`IERC6909`: Add the interface for ERC-6909. |
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,117 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.20; | ||
|
||
import {IERC165} from "../utils/introspection/IERC165.sol"; | ||
|
||
/** | ||
* @dev Required interface of an ERC-6909 compliant contract, as defined in the | ||
* https://eips.ethereum.org/EIPS/eip-6909[ERC]. | ||
*/ | ||
interface IERC6909 is IERC165 { | ||
/** | ||
* @dev Emitted when the allowance of a `spender` for an `owner` is set by a call to `approve` for a | ||
* token of type `id`. The new allowance is `amount`. | ||
arr00 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
*/ | ||
event Approval(address indexed owner, address indexed spender, uint256 indexed id, uint256 amount); | ||
|
||
/** | ||
* @dev Emitted when `owner` grants or revokes operator status for a `spender`. | ||
*/ | ||
event OperatorSet(address indexed owner, address indexed spender, bool isOperator); | ||
arr00 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** | ||
* @dev Emitted when `amount` tokens of type `id` are moved from `from` to `to` initiated by `caller`. | ||
*/ | ||
event Transfer(address caller, address indexed from, address indexed to, uint256 indexed id, uint256 amount); | ||
arr00 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** | ||
* @dev Returns the amount of tokens of type `id` owned by `owner`. | ||
*/ | ||
function balanceOf(address owner, uint256 id) external view returns (uint256); | ||
|
||
/** | ||
* @dev Returns the amount of tokens of type `id` that `spender` is allowed to spend on behalf of `owner`. | ||
* | ||
* NOTE: Does not include operator allowances. | ||
*/ | ||
function allowance(address owner, address spender, uint256 id) external view returns (uint256); | ||
|
||
/** | ||
* @dev Returns true if `spender` is set as an operator for `owner`. | ||
*/ | ||
function isOperator(address owner, address spender) external view returns (bool); | ||
|
||
/** | ||
* @dev Sets an approval to `spender` for `amount` tokens of type `id` from the caller's tokens. | ||
* | ||
* Must return true. | ||
*/ | ||
function approve(address spender, uint256 id, uint256 amount) external returns (bool); | ||
|
||
/** | ||
* @dev Grants or revokes unlimited transfer permission of any token id to `spender` for the caller's tokens. | ||
* | ||
* Must return true. | ||
*/ | ||
function setOperator(address spender, bool isOperator) external returns (bool); | ||
arr00 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** | ||
* @dev Transfers `amount` of token type `id` from the caller's account to `to`. | ||
* | ||
* Must return true. | ||
*/ | ||
function transfer(address to, uint256 id, uint256 amount) external returns (bool); | ||
arr00 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** | ||
* @dev Transfers `amount` of token type `id` from `from` to `to`. | ||
* | ||
* Must return true. | ||
*/ | ||
function transferFrom(address from, address to, uint256 id, uint256 amount) external returns (bool); | ||
arr00 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
/** | ||
* @dev Optional extension of {IERC6909} that adds metadata functions. | ||
*/ | ||
interface IERC6909Metadata is IERC6909 { | ||
/** | ||
* @dev Returns the name of the token of type `id`. | ||
*/ | ||
function name(uint256 id) external view returns (string memory); | ||
|
||
/** | ||
* @dev Returns the ticker symbol of the token of type `id`. | ||
*/ | ||
function symbol(uint256 id) external view returns (string memory); | ||
|
||
/** | ||
* @dev Returns the number of decimals for the token of type `id`. | ||
*/ | ||
function decimals(uint256 id) external view returns (uint8); | ||
} | ||
|
||
/** | ||
* @dev Optional extension of {IERC6909} that adds content URI functions. | ||
*/ | ||
interface IERC6909ContentURI is IERC6909 { | ||
/** | ||
* @dev Returns URI for the contract. | ||
*/ | ||
function contractURI() external view returns (string memory); | ||
|
||
/** | ||
* @dev Returns the URI for the token of type `id`. | ||
*/ | ||
function tokenURI(uint256 id) external view returns (string memory); | ||
} | ||
|
||
/** | ||
* @dev Optional extension of {IERC6909} that adds a token supply function. | ||
*/ | ||
interface IERC6909TokenSupply is IERC6909 { | ||
/** | ||
* @dev Returns the total supply of the token of type `id`. | ||
*/ | ||
function totalSupply(uint256 id) external view returns (uint256); | ||
} |
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.