-
Notifications
You must be signed in to change notification settings - Fork 12.4k
RBAC and Ownable migration towards Roles #1291
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 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
c8c2309
Role tests (#1228)
nventuro ed04195
Removed RBAC tokens (#1229)
nventuro 5b7ec56
Roles can now be transfered. (#1235)
nventuro 0530e1e
True Ownership (#1247)
nventuro d8e7c25
MintableToken using Roles (#1236)
nventuro a14963b
Improved Roles API. (#1280)
nventuro 4d4a004
Added PauserRole. (#1283)
nventuro b2f350d
Remove Claimable, DelayedClaimable, Heritable (#1274)
frangio c529524
Merge remote-tracking branch 'upstream/master' into rbac-migration
frangio bf4a211
Role behavior tests (#1285)
nventuro 199e156
Migrate Ownable to Roles (#1287)
nventuro d4dea3c
Remove RBAC, SignatureBouncer refactor (#1289)
nventuro e9cc437
feat: implement ERC721Mintable and ERC721Burnable (#1276)
shrugs 436c89f
Merge branch 'master' into rbac-migration
c81e75d
Fix the merge with the privatization branch
f6306b8
remove duplicate CapperRole test
frangio 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
feat: implement ERC721Mintable and ERC721Burnable (#1276)
* feat: implement ERC721Mintable and ERC721Burnable * fix: linting errors * fix: remove unused mintable mock for ERC721BasicMock * fix: add finishMinting tests * fix: catch MintFinished typo * inline ERC721Full behavior * undo pretty formatting * fix lint errors * rename canMint to onlyBeforeMintingFinished for consistency with ERC20Mintable
- Loading branch information
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,18 @@ | ||
| pragma solidity ^0.4.24; | ||
|
|
||
| import "../token/ERC721/ERC721.sol"; | ||
| import "../token/ERC721/ERC721Mintable.sol"; | ||
| import "../token/ERC721/ERC721Burnable.sol"; | ||
|
|
||
|
|
||
| /** | ||
| * @title ERC721MintableBurnableImpl | ||
| */ | ||
| contract ERC721MintableBurnableImpl is ERC721, ERC721Mintable, ERC721Burnable { | ||
| constructor() | ||
| ERC721Mintable() | ||
| ERC721("Test", "TEST") | ||
| public | ||
| { | ||
| } | ||
| } |
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,13 @@ | ||
| pragma solidity ^0.4.24; | ||
|
|
||
| import "./ERC721.sol"; | ||
|
|
||
|
|
||
| contract ERC721Burnable is ERC721 { | ||
| function burn(uint256 _tokenId) | ||
| public | ||
| { | ||
| require(_isApprovedOrOwner(msg.sender, _tokenId)); | ||
| _burn(ownerOf(_tokenId), _tokenId); | ||
| } | ||
| } |
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,71 @@ | ||
| pragma solidity ^0.4.24; | ||
|
|
||
| import "./ERC721.sol"; | ||
| import "../../access/roles/MinterRole.sol"; | ||
|
|
||
|
|
||
| /** | ||
| * @title ERC721Mintable | ||
| * @dev ERC721 minting logic | ||
| */ | ||
| contract ERC721Mintable is ERC721, MinterRole { | ||
| event Minted(address indexed to, uint256 tokenId); | ||
| event MintingFinished(); | ||
|
|
||
| bool public mintingFinished = false; | ||
|
|
||
| modifier onlyBeforeMintingFinished() { | ||
| require(!mintingFinished); | ||
| _; | ||
| } | ||
|
|
||
| /** | ||
| * @dev Function to mint tokens | ||
| * @param _to The address that will receive the minted tokens. | ||
| * @param _tokenId The token id to mint. | ||
| * @return A boolean that indicates if the operation was successful. | ||
| */ | ||
| function mint( | ||
| address _to, | ||
| uint256 _tokenId | ||
| ) | ||
| public | ||
| onlyMinter | ||
| onlyBeforeMintingFinished | ||
| returns (bool) | ||
| { | ||
| _mint(_to, _tokenId); | ||
| emit Minted(_to, _tokenId); | ||
| return true; | ||
| } | ||
|
|
||
| function mintWithTokenURI( | ||
| address _to, | ||
| uint256 _tokenId, | ||
| string _tokenURI | ||
| ) | ||
| public | ||
| onlyMinter | ||
| onlyBeforeMintingFinished | ||
| returns (bool) | ||
| { | ||
| mint(_to, _tokenId); | ||
| _setTokenURI(_tokenId, _tokenURI); | ||
| return true; | ||
| } | ||
|
|
||
| /** | ||
| * @dev Function to stop minting new tokens. | ||
| * @return True if the operation was successful. | ||
| */ | ||
| function finishMinting() | ||
| public | ||
| onlyMinter | ||
| onlyBeforeMintingFinished | ||
| returns (bool) | ||
| { | ||
| mintingFinished = true; | ||
| emit MintingFinished(); | ||
| return true; | ||
| } | ||
| } | ||
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.
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.
public? Nooo
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.
good point; if we update this, also update the
ERC20Mintablethat this was copy/pasted from