forked from PundiAI/fx-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: update integration test (PundiAI#278)
- Loading branch information
Showing
5 changed files
with
726 additions
and
44 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,18 +1,68 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol"; | ||
import {ERC721Burnable} from "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; | ||
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; | ||
import {ERC721Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; | ||
import {ERC721URIStorageUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol"; | ||
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; | ||
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; | ||
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; | ||
import {CountersUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol"; | ||
|
||
contract ERC721TokenTest is ERC721, ERC721Burnable, Ownable { | ||
constructor() ERC721("ERC721TokenTest", "TTT") {} | ||
contract ERC721TokenTest is | ||
Initializable, | ||
ERC721Upgradeable, | ||
ERC721URIStorageUpgradeable, | ||
OwnableUpgradeable, | ||
UUPSUpgradeable | ||
{ | ||
using CountersUpgradeable for CountersUpgradeable.Counter; | ||
|
||
function mint(address _to, uint256 _id) external onlyOwner { | ||
_safeMint(_to, _id); | ||
CountersUpgradeable.Counter private _tokenIdCounter; | ||
|
||
/// @custom:oz-upgrades-unsafe-allow constructor | ||
constructor() { | ||
_disableInitializers(); | ||
} | ||
|
||
function initialize() public initializer { | ||
__ERC721_init("ERC721TokenTest", "TTT"); | ||
__ERC721URIStorage_init(); | ||
__Ownable_init(); | ||
__UUPSUpgradeable_init(); | ||
} | ||
|
||
function _baseURI() internal pure override returns (string memory) { | ||
return "ipfs://test-url"; | ||
} | ||
|
||
function safeMint(address to, string memory uri) public onlyOwner { | ||
uint256 tokenId = _tokenIdCounter.current(); | ||
_tokenIdCounter.increment(); | ||
_safeMint(to, tokenId); | ||
_setTokenURI(tokenId, uri); | ||
} | ||
|
||
/* solhint-disable no-empty-blocks */ | ||
function _authorizeUpgrade( | ||
address newImplementation | ||
) internal override onlyOwner {} | ||
|
||
// The following functions are overrides required by Solidity. | ||
|
||
function _burn( | ||
uint256 tokenId | ||
) internal override(ERC721Upgradeable, ERC721URIStorageUpgradeable) { | ||
super._burn(tokenId); | ||
} | ||
|
||
function tokenURI( | ||
uint256 tokenId | ||
) | ||
public | ||
view | ||
override(ERC721Upgradeable, ERC721URIStorageUpgradeable) | ||
returns (string memory) | ||
{ | ||
return super.tokenURI(tokenId); | ||
} | ||
} |
Oops, something went wrong.