-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #904 from moonbeam-foundation/themacexpert/openzep
Revamp Open Zeppelin Contract Wizard Page
- Loading branch information
Showing
10 changed files
with
119 additions
and
93 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
.snippets/code/builders/build/eth-api/dev-env/openzeppelin/ERC1155.sol
This file contains 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,34 @@ | ||
// SPDX-License-Identifier: MIT | ||
// Compatible with OpenZeppelin Contracts ^5.0.0 | ||
pragma solidity ^0.8.20; | ||
|
||
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; | ||
import "@openzeppelin/contracts/access/Ownable.sol"; | ||
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Pausable.sol"; | ||
|
||
contract MyToken is ERC1155, Ownable, ERC1155Pausable { | ||
constructor() ERC1155("") Ownable() { | ||
_mint(msg.sender, 0, 1000 * 10 ** 18, ""); | ||
_mint(msg.sender, 1, 1, ""); | ||
} | ||
|
||
function setURI(string memory newuri) public onlyOwner { | ||
_setURI(newuri); | ||
} | ||
|
||
function pause() public onlyOwner { | ||
_pause(); | ||
} | ||
|
||
function unpause() public onlyOwner { | ||
_unpause(); | ||
} | ||
|
||
// The following function is an override required by Solidity | ||
function _update(address from, address to, uint256[] memory ids, uint256[] memory values) | ||
internal | ||
override(ERC1155, ERC1155Pausable) | ||
{ | ||
super._update(from, to, ids, values); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
.snippets/code/builders/build/eth-api/dev-env/openzeppelin/ERC20.sol
This file contains 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,21 @@ | ||
// SPDX-License-Identifier: MIT | ||
// Compatible with OpenZeppelin Contracts ^5.0.0 | ||
pragma solidity ^0.8.20; | ||
|
||
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | ||
import "@openzeppelin/contracts/access/Ownable.sol"; | ||
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol"; | ||
|
||
contract MyToken is ERC20, Ownable, ERC20Permit { | ||
constructor(address initialOwner) | ||
ERC20("MyToken", "MTK") | ||
Ownable(initialOwner) | ||
ERC20Permit("MyToken") | ||
{ | ||
_mint(msg.sender, 1000 * 10 ** decimals()); | ||
} | ||
|
||
function mint(address to, uint256 amount) public onlyOwner { | ||
_mint(to, amount); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
.snippets/code/builders/build/eth-api/dev-env/openzeppelin/ERC721.sol
This file contains 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,48 @@ | ||
// SPDX-License-Identifier: MIT | ||
// Compatible with OpenZeppelin Contracts ^5.0.0 | ||
pragma solidity ^0.8.20; | ||
|
||
import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; | ||
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; | ||
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; | ||
import "@openzeppelin/contracts/access/Ownable.sol"; | ||
|
||
contract MyToken is ERC721, ERC721Enumerable, ERC721Burnable, Ownable { | ||
constructor(address initialOwner) | ||
ERC721("MyToken", "MTK") | ||
Ownable(initialOwner) | ||
{} | ||
|
||
function _baseURI() internal pure override returns (string memory) { | ||
return "Test"; | ||
} | ||
|
||
function safeMint(address to, uint256 tokenId) public onlyOwner { | ||
_safeMint(to, tokenId); | ||
} | ||
|
||
// The following functions are overrides required by Solidity | ||
function _update(address to, uint256 tokenId, address auth) | ||
internal | ||
override(ERC721, ERC721Enumerable) | ||
returns (address) | ||
{ | ||
return super._update(to, tokenId, auth); | ||
} | ||
|
||
function _increaseBalance(address account, uint128 value) | ||
internal | ||
override(ERC721, ERC721Enumerable) | ||
{ | ||
super._increaseBalance(account, value); | ||
} | ||
|
||
function supportsInterface(bytes4 interfaceId) | ||
public | ||
view | ||
override(ERC721, ERC721Enumerable) | ||
returns (bool) | ||
{ | ||
return super.supportsInterface(interfaceId); | ||
} | ||
} |
This file contains 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
Binary file modified
BIN
+30.6 KB
(120%)
images/builders/build/eth-api/dev-env/openzeppelin/contracts/oz-contracts-1.webp
Binary file not shown.
Binary file modified
BIN
+66.4 KB
(150%)
images/builders/build/eth-api/dev-env/openzeppelin/contracts/oz-contracts-2.webp
Binary file not shown.
Binary file modified
BIN
+92.9 KB
(170%)
images/builders/build/eth-api/dev-env/openzeppelin/contracts/oz-contracts-3.webp
Binary file not shown.
Binary file modified
BIN
+106 KB
(160%)
images/builders/build/eth-api/dev-env/openzeppelin/contracts/oz-contracts-4.webp
Binary file not shown.
Binary file modified
BIN
+177 KB
(210%)
images/builders/build/eth-api/dev-env/openzeppelin/contracts/oz-contracts-5.webp
Binary file not shown.
Binary file added
BIN
+322 KB
images/builders/build/eth-api/dev-env/openzeppelin/contracts/oz-contracts-6.webp
Binary file not shown.