-
Notifications
You must be signed in to change notification settings - Fork 0
Implement veNFT interface #23
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
Open
hwrdtm
wants to merge
19
commits into
master
Choose a base branch
from
feature/node-4819-stakingdiamond-nftfacet
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.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
08b5a30
Update ABIs and rust bindings
hwrdtm bdd2fdd
Implement veNFT interface and link with existing staking system
hwrdtm 5f600f5
Rename stake balanceOf
hwrdtm 9d499dc
Fix tests after renaming balanceOf
hwrdtm 9258345
Fix wagmi build
hwrdtm 118905c
wagmi generate
hwrdtm 9cd6e7d
Add StakingNFTFacet to hardhat config
hwrdtm 1e6eec2
Update ABIs and rust bindings
hwrdtm 0d1919a
Deploy StakingNFTFacet
hwrdtm 7d54264
Fix tests
hwrdtm 3c4f12e
Fix tests
hwrdtm 24d528d
Implement some StakingNFTFacet tests
hwrdtm ba81aee
Implement tests
hwrdtm fd9004e
Prettier
hwrdtm db85fbd
Update ABIs and rust bindings
hwrdtm 9c7b80e
Update ABIs and rust bindings
hwrdtm fc092f4
Fix build
hwrdtm 3a9d9ec
Update ABIs and rust bindings
hwrdtm a2a58db
Merge branch 'master' into feature/node-4819-stakingdiamond-nftfacet
glitch003 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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,159 @@ | ||
| // SPDX-License-Identifier: MIT | ||
| // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol) | ||
|
|
||
| pragma solidity ^0.8.0; | ||
|
|
||
| /** | ||
| * @dev Required interface of an ERC721 compliant contract. | ||
| * @dev This is an exact copy of the OpenZeppelin IERC721 interface EXCEPT for the supportsInterface function | ||
| * because diamond contracts already implement this via the DiamondLoupeFacet and this breaks some tools' | ||
| * ability to compile, for example WAGMI with `npx wagmi generate`. | ||
| */ | ||
| interface IERC721 { | ||
| /** | ||
| * @dev Emitted when `tokenId` token is transferred from `from` to `to`. | ||
| */ | ||
| event Transfer( | ||
| address indexed from, | ||
| address indexed to, | ||
| uint256 indexed tokenId | ||
| ); | ||
|
|
||
| /** | ||
| * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. | ||
| */ | ||
| event Approval( | ||
| address indexed owner, | ||
| address indexed approved, | ||
| uint256 indexed tokenId | ||
| ); | ||
|
|
||
| /** | ||
| * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. | ||
| */ | ||
| event ApprovalForAll( | ||
| address indexed owner, | ||
| address indexed operator, | ||
| bool approved | ||
| ); | ||
|
|
||
| /** | ||
| * @dev Returns the number of tokens in ``owner``'s account. | ||
| */ | ||
| function balanceOf(address owner) external view returns (uint256 balance); | ||
|
|
||
| /** | ||
| * @dev Returns the owner of the `tokenId` token. | ||
| * | ||
| * Requirements: | ||
| * | ||
| * - `tokenId` must exist. | ||
| */ | ||
| function ownerOf(uint256 tokenId) external view returns (address owner); | ||
|
|
||
| /** | ||
| * @dev Safely transfers `tokenId` token from `from` to `to`. | ||
| * | ||
| * Requirements: | ||
| * | ||
| * - `from` cannot be the zero address. | ||
| * - `to` cannot be the zero address. | ||
| * - `tokenId` token must exist and be owned by `from`. | ||
| * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. | ||
| * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. | ||
| * | ||
| * Emits a {Transfer} event. | ||
| */ | ||
| function safeTransferFrom( | ||
| address from, | ||
| address to, | ||
| uint256 tokenId, | ||
| bytes calldata data | ||
| ) external; | ||
|
|
||
| /** | ||
| * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients | ||
| * are aware of the ERC721 protocol to prevent tokens from being forever locked. | ||
| * | ||
| * Requirements: | ||
| * | ||
| * - `from` cannot be the zero address. | ||
| * - `to` cannot be the zero address. | ||
| * - `tokenId` token must exist and be owned by `from`. | ||
| * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. | ||
| * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. | ||
| * | ||
| * Emits a {Transfer} event. | ||
| */ | ||
| function safeTransferFrom( | ||
| address from, | ||
| address to, | ||
| uint256 tokenId | ||
| ) external; | ||
|
|
||
| /** | ||
| * @dev Transfers `tokenId` token from `from` to `to`. | ||
| * | ||
| * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 | ||
| * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must | ||
| * understand this adds an external call which potentially creates a reentrancy vulnerability. | ||
| * | ||
| * Requirements: | ||
| * | ||
| * - `from` cannot be the zero address. | ||
| * - `to` cannot be the zero address. | ||
| * - `tokenId` token must be owned by `from`. | ||
| * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. | ||
| * | ||
| * Emits a {Transfer} event. | ||
| */ | ||
| function transferFrom(address from, address to, uint256 tokenId) external; | ||
|
|
||
| /** | ||
| * @dev Gives permission to `to` to transfer `tokenId` token to another account. | ||
| * The approval is cleared when the token is transferred. | ||
| * | ||
| * Only a single account can be approved at a time, so approving the zero address clears previous approvals. | ||
| * | ||
| * Requirements: | ||
| * | ||
| * - The caller must own the token or be an approved operator. | ||
| * - `tokenId` must exist. | ||
| * | ||
| * Emits an {Approval} event. | ||
| */ | ||
| function approve(address to, uint256 tokenId) external; | ||
|
|
||
| /** | ||
| * @dev Approve or remove `operator` as an operator for the caller. | ||
| * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. | ||
| * | ||
| * Requirements: | ||
| * | ||
| * - The `operator` cannot be the caller. | ||
| * | ||
| * Emits an {ApprovalForAll} event. | ||
| */ | ||
| function setApprovalForAll(address operator, bool approved) external; | ||
|
|
||
| /** | ||
| * @dev Returns the account approved for `tokenId` token. | ||
| * | ||
| * Requirements: | ||
| * | ||
| * - `tokenId` must exist. | ||
| */ | ||
| function getApproved( | ||
| uint256 tokenId | ||
| ) external view returns (address operator); | ||
|
|
||
| /** | ||
| * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. | ||
| * | ||
| * See {setApprovalForAll} | ||
| */ | ||
| function isApprovedForAll( | ||
| address owner, | ||
| address operator | ||
| ) external view returns (bool); | ||
| } | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should import this from openzeppelin instead of pasting it here, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On line 8 (few lines below) I explain why I am doing this approach instead. Open to better ideas tho!