Skip to content

Commit

Permalink
test: update integration test (PundiAI#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
todd-woko authored Mar 27, 2024
1 parent 7a1796d commit 4617a8d
Show file tree
Hide file tree
Showing 5 changed files with 726 additions and 44 deletions.
2 changes: 1 addition & 1 deletion contract/contract.go

Large diffs are not rendered by default.

64 changes: 57 additions & 7 deletions solidity/contracts/test/ERC721TokenTest.sol
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);
}
}
Loading

0 comments on commit 4617a8d

Please sign in to comment.