Skip to content

Commit

Permalink
v2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
boyuanx committed Nov 7, 2023
1 parent 66f260e commit 3e830d3
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 6 deletions.
23 changes: 22 additions & 1 deletion contracts/core/TTFutureTokenV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ contract TTFutureTokenV2 is ITTFutureTokenV2, ERC721AQueryableUpgradeable {
address public authorizedMinter;
bool public allowTransfer;

// v2.0.1
string public baseUri;
event DidSetBaseURI(string prevURI, string newURI);

error Unauthorized();

constructor() {
Expand Down Expand Up @@ -62,7 +66,7 @@ contract TTFutureTokenV2 is ITTFutureTokenV2, ERC721AQueryableUpgradeable {
* token with tokenId == actualId is minted.
*/
function safeMint(address to) external override returns (uint256 tokenId) {
if (msg.sender != authorizedMinter) revert Unauthorized();
if (_msgSenderERC721A() != authorizedMinter) revert Unauthorized();
tokenId = _nextTokenId();
_safeMint(to, 1);
}
Expand Down Expand Up @@ -92,6 +96,15 @@ contract TTFutureTokenV2 is ITTFutureTokenV2, ERC721AQueryableUpgradeable {
super.safeTransferFrom(from, to, tokenId, _data);
}

function setURI(string calldata uri) external {
if (
_msgSenderERC721A() !=
ITokenTableUnlockerV2(authorizedMinter).owner()
) revert Unauthorized();
emit DidSetBaseURI(baseUri, uri);
baseUri = uri;
}

/**
* @notice Returns claim info for a given tokenId/actualId
* @dev We assume the authorized minter is an instance of TTUV2.
Expand Down Expand Up @@ -121,4 +134,12 @@ contract TTFutureTokenV2 is ITTFutureTokenV2, ERC721AQueryableUpgradeable {
amountAlreadyClaimed = updatedAmountClaimed_ - deltaAmountClaimable_;
isCancelable = ITokenTableUnlockerV2(authorizedMinter).isCancelable();
}

function version() external pure override returns (string memory) {
return "2.0.1";
}

function _baseURI() internal view virtual override returns (string memory) {
return baseUri;
}
}
4 changes: 4 additions & 0 deletions contracts/core/TTTrackerTokenV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,8 @@ contract TTTrackerTokenV2 is ITTTrackerTokenV2, IERC20Metadata, Initializable {
) external returns (bool) {
return false;
}

function version() external pure returns (string memory) {
return "2.0.1";
}
}
4 changes: 4 additions & 0 deletions contracts/core/TokenTableUnlockerV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,10 @@ contract TokenTableUnlockerV2 is
);
}

function version() external pure returns (string memory) {
return "2.0.1";
}

function calculateAmountClaimable(
uint256 actualId
)
Expand Down
5 changes: 4 additions & 1 deletion contracts/interfaces/ITTFutureTokenV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
pragma solidity ^0.8.17;

import {IERC721AQueryableUpgradeable} from "erc721a-upgradeable/contracts/interfaces/IERC721AQueryableUpgradeable.sol";
import {IVersionable} from "./IVersionable.sol";

interface ITTFutureTokenV2 is IERC721AQueryableUpgradeable {
interface ITTFutureTokenV2 is IERC721AQueryableUpgradeable, IVersionable {
function initialize(address projectToken, bool allowTransfer_) external;

function setAuthorizedMinterSingleUse(address authorizedMinter_) external;

function safeMint(address to) external returns (uint256 tokenId);

function setURI(string calldata uri) external;

function getClaimInfo(
uint256 tokenId
)
Expand Down
4 changes: 3 additions & 1 deletion contracts/interfaces/ITTTrackerTokenV2.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;

interface ITTTrackerTokenV2 {
import {IVersionable} from "./IVersionable.sol";

interface ITTTrackerTokenV2 is IVersionable {
function initialize(address ttuInstance_) external;
}
3 changes: 2 additions & 1 deletion contracts/interfaces/ITokenTableUnlockerV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
pragma solidity ^0.8.17;

import {IOwnable} from "./IOwnable.sol";
import {IVersionable} from "./IVersionable.sol";

/**
* @title ITokenTableUnlockerV2
* @author Jack Xu @ EthSign
* @dev The lightweight interface for TokenTableUnlockerV2, which handles token
* unlocking and distribution for TokenTable.
*/
abstract contract ITokenTableUnlockerV2 is IOwnable {
abstract contract ITokenTableUnlockerV2 is IOwnable, IVersionable {
event PresetCreated(bytes32 presetId);
event ActualCreated(bytes32 presetId, uint256 actualId);
event TokensDeposited(uint256 actualId, uint256 amount);
Expand Down
6 changes: 6 additions & 0 deletions contracts/interfaces/IVersionable.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;

interface IVersionable {
function version() external pure returns (string memory);
}
2 changes: 1 addition & 1 deletion deploy/01-deploy-ttudeployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ const deployTTUDeployer: DeployFunction = async (
}

export default deployTTUDeployer
deployTTUDeployer.tags = ['all', 'TTUDeployer']
deployTTUDeployer.tags = ['TTUDeployer']
2 changes: 1 addition & 1 deletion deploy/02-deploy-ttu-standalone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ const deployTTUV2: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
}

export default deployTTUV2
deployTTUV2.tags = ['all', 'TTUV2']
deployTTUV2.tags = ['TTUV2']

0 comments on commit 3e830d3

Please sign in to comment.