pausable added, destroyable can be disabled
This commit is contained in:
parent
02a3164658
commit
31f0c6f84e
|
@ -9,8 +9,9 @@ import "./ERC1155Metadata.sol";
|
|||
import "@openzeppelin/contracts/utils/Strings.sol";
|
||||
import "@openzeppelin/contracts/utils/Base64.sol";
|
||||
import "@openzeppelin/contracts/access/Ownable.sol";
|
||||
import "@openzeppelin/contracts/security/Pausable.sol";
|
||||
|
||||
contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, ERC1155Metadata, Ownable {
|
||||
contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, ERC1155Metadata, Ownable, Pausable {
|
||||
using Address for address;
|
||||
|
||||
mapping (uint256 => address) public contracts;
|
||||
|
@ -94,6 +95,21 @@ contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, ERC1155Metadata, O
|
|||
return contracts[_id] != address(0);
|
||||
}
|
||||
|
||||
bool public destroyable = true;
|
||||
|
||||
/**
|
||||
@notice Destroy the contract
|
||||
@dev Only if it hasn't been disabled
|
||||
*/
|
||||
function destroy() public onlyOwner whenPaused {
|
||||
require(destroyable, "destroy() has been disabled");
|
||||
selfdestruct(payable(msg.sender));
|
||||
}
|
||||
|
||||
function disableDestroy() public onlyOwner {
|
||||
destroyable = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@notice Converts old-style NFT to new-style
|
||||
@dev For an NFT ID, queries and transfers tokens from the appropriate
|
||||
|
@ -102,7 +118,7 @@ contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, ERC1155Metadata, O
|
|||
@param _id NFT ID
|
||||
@param _quantity how many to wrap
|
||||
*/
|
||||
function wrap(uint256 _id, uint256 _quantity) external {
|
||||
function wrap(uint256 _id, uint256 _quantity) external whenNotPaused {
|
||||
address tokenContract = contracts[_id];
|
||||
require(tokenContract != address(0), "invalid id");
|
||||
IMastersFedi curio = IMastersFedi(tokenContract);
|
||||
|
@ -129,7 +145,7 @@ contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, ERC1155Metadata, O
|
|||
@param _ids array of NFT IDs
|
||||
@param _quantities how many to wrap of each
|
||||
*/
|
||||
function wrapBatch(uint256[] calldata _ids, uint256[] calldata _quantities) external {
|
||||
function wrapBatch(uint256[] calldata _ids, uint256[] calldata _quantities) external whenNotPaused {
|
||||
require(_ids.length == _quantities.length, "ids and quantities must match");
|
||||
|
||||
address _to = msg.sender;
|
||||
|
@ -166,7 +182,7 @@ contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, ERC1155Metadata, O
|
|||
@param _id NFT ID
|
||||
@param _quantity how many to unwrap
|
||||
*/
|
||||
function unwrap(uint256 _id, uint256 _quantity) external {
|
||||
function unwrap(uint256 _id, uint256 _quantity) external whenNotPaused {
|
||||
address tokenContract = contracts[_id];
|
||||
require(tokenContract != address(0), "invalid id");
|
||||
IMastersFedi curio = IMastersFedi(tokenContract);
|
||||
|
@ -185,7 +201,7 @@ contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, ERC1155Metadata, O
|
|||
@param _ids array of NFT IDs
|
||||
@param _quantities how many to unwrap of each
|
||||
*/
|
||||
function unwrapBatch(uint256[] calldata _ids, uint256[] calldata _quantities) external {
|
||||
function unwrapBatch(uint256[] calldata _ids, uint256[] calldata _quantities) external whenNotPaused {
|
||||
require(_ids.length == _quantities.length, "ids and quantities must match");
|
||||
|
||||
for (uint256 i=0; i < _ids.length; ++i) {
|
||||
|
|
Loading…
Reference in New Issue