-
Notifications
You must be signed in to change notification settings - Fork 4
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 #17 from polymorpher/ws-miniwallet-v0.1
ws-miniwallet-v0.1 MiniWallet Functionality
- Loading branch information
Showing
25 changed files
with
362 additions
and
641 deletions.
There are no files selected for viewing
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
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,84 @@ | ||
[ | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "address", | ||
"name": "_logic", | ||
"type": "address" | ||
}, | ||
{ | ||
"internalType": "bytes", | ||
"name": "_data", | ||
"type": "bytes" | ||
} | ||
], | ||
"stateMutability": "payable", | ||
"type": "constructor" | ||
}, | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ | ||
"indexed": false, | ||
"internalType": "address", | ||
"name": "previousAdmin", | ||
"type": "address" | ||
}, | ||
{ | ||
"indexed": false, | ||
"internalType": "address", | ||
"name": "newAdmin", | ||
"type": "address" | ||
} | ||
], | ||
"name": "AdminChanged", | ||
"type": "event" | ||
}, | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ | ||
"indexed": true, | ||
"internalType": "address", | ||
"name": "beacon", | ||
"type": "address" | ||
} | ||
], | ||
"name": "BeaconUpgraded", | ||
"type": "event" | ||
}, | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ | ||
"indexed": true, | ||
"internalType": "address", | ||
"name": "implementation", | ||
"type": "address" | ||
} | ||
], | ||
"name": "Upgraded", | ||
"type": "event" | ||
}, | ||
{ | ||
"stateMutability": "payable", | ||
"type": "fallback" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "implementation", | ||
"outputs": [ | ||
{ | ||
"internalType": "address", | ||
"name": "impl", | ||
"type": "address" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"stateMutability": "payable", | ||
"type": "receive" | ||
} | ||
] |
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 |
---|---|---|
|
@@ -1043,4 +1043,4 @@ | |
"stateMutability": "nonpayable", | ||
"type": "function" | ||
} | ||
], | ||
] |
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
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
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
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
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
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,57 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
pragma solidity ^0.8.4; | ||
|
||
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; | ||
import "@openzeppelin/contracts/access/AccessControl.sol"; | ||
|
||
/// @custom:security-contact [email protected] | ||
contract TestERC1155 is ERC1155, AccessControl { | ||
bytes32 public constant URI_SETTER_ROLE = keccak256("URI_SETTER_ROLE"); | ||
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); | ||
|
||
constructor(uint256[] memory tokenIds, uint256[] memory amounts) | ||
ERC1155("") | ||
{ | ||
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender); | ||
_grantRole(URI_SETTER_ROLE, msg.sender); | ||
_grantRole(MINTER_ROLE, msg.sender); | ||
for (uint32 i = 0; i < tokenIds.length; i++) { | ||
mint(msg.sender, tokenIds[i], amounts[i], ""); | ||
} | ||
} | ||
|
||
function setURI(string memory newuri) public onlyRole(URI_SETTER_ROLE) { | ||
_setURI(newuri); | ||
} | ||
|
||
function mint( | ||
address account, | ||
uint256 id, | ||
uint256 amount, | ||
bytes memory data | ||
) public onlyRole(MINTER_ROLE) { | ||
_mint(account, id, amount, data); | ||
} | ||
|
||
function mintBatch( | ||
address to, | ||
uint256[] memory ids, | ||
uint256[] memory amounts, | ||
bytes memory data | ||
) public onlyRole(MINTER_ROLE) { | ||
_mintBatch(to, ids, amounts, data); | ||
} | ||
|
||
// The following functions are overrides required by Solidity. | ||
|
||
function supportsInterface(bytes4 interfaceId) | ||
public | ||
view | ||
override(ERC1155, AccessControl) | ||
returns (bool) | ||
{ | ||
return (ERC1155.supportsInterface(interfaceId) || | ||
AccessControl.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
pragma solidity ^0.8.4; | ||
|
||
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | ||
import "@openzeppelin/contracts/access/AccessControl.sol"; | ||
|
||
/// @custom:security-contact [email protected] | ||
contract TestERC20 is ERC20, AccessControl { | ||
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); | ||
|
||
constructor(uint256 _amount) ERC20("TestERC20", "T20") { | ||
_mint(msg.sender, _amount * 10**decimals()); | ||
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender); | ||
_grantRole(MINTER_ROLE, msg.sender); | ||
} | ||
|
||
function mint(address to, uint256 amount) public onlyRole(MINTER_ROLE) { | ||
_mint(to, amount); | ||
} | ||
} |
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,45 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
pragma solidity ^0.8.4; | ||
|
||
import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; | ||
import "@openzeppelin/contracts/access/AccessControl.sol"; | ||
import "@openzeppelin/contracts/utils/Counters.sol"; | ||
|
||
/// @custom:security-contact [email protected] | ||
contract TestERC721 is ERC721, AccessControl { | ||
using Counters for Counters.Counter; | ||
|
||
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); | ||
Counters.Counter private _tokenIdCounter; | ||
|
||
constructor(uint256 _amount) ERC721("TestERC721", "T721") { | ||
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender); | ||
_grantRole(MINTER_ROLE, msg.sender); | ||
for (uint32 i = 0; i < _amount; i++) { | ||
safeMint(msg.sender); | ||
} | ||
} | ||
|
||
function _baseURI() internal pure override returns (string memory) { | ||
return ""; | ||
} | ||
|
||
function safeMint(address to) public onlyRole(MINTER_ROLE) { | ||
uint256 tokenId = _tokenIdCounter.current(); | ||
_tokenIdCounter.increment(); | ||
_safeMint(to, tokenId); | ||
} | ||
|
||
// The following functions are overrides required by Solidity. | ||
|
||
function supportsInterface(bytes4 interfaceId) | ||
public | ||
view | ||
override(ERC721, AccessControl) | ||
returns (bool) | ||
{ | ||
return (ERC721.supportsInterface(interfaceId) || | ||
AccessControl.supportsInterface(interfaceId)); | ||
} | ||
} |
Oops, something went wrong.