Skip to content

Commit

Permalink
upgrade contract version / make isPoi visibility public
Browse files Browse the repository at this point in the history
  • Loading branch information
nour-karoui committed Nov 4, 2024
1 parent 5edc1bf commit 977706d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 18 deletions.
12 changes: 6 additions & 6 deletions src/IPNFT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import { IReservable } from "./IReservable.sol";
_| ▓▓_| ▓▓ | ▓▓ \▓▓▓▓ ▓▓ | ▓▓
| ▓▓ \ ▓▓ | ▓▓ \▓▓▓ ▓▓ | ▓▓
\▓▓▓▓▓▓\▓▓ \▓▓ \▓▓\▓▓ \▓▓
*/
*/

/// @title IPNFT V2.5
/// @title IPNFT V2.5.1
/// @author molecule.to
/// @notice IP-NFTs capture intellectual property to be traded and synthesized
contract IPNFT is ERC721URIStorageUpgradeable, ERC721BurnableUpgradeable, IReservable, UUPSUpgradeable, OwnableUpgradeable, PausableUpgradeable {
Expand Down Expand Up @@ -122,8 +122,8 @@ contract IPNFT is ERC721URIStorageUpgradeable, ERC721BurnableUpgradeable, IReser
whenNotPaused
returns (uint256)
{
bool isPoi = _verifyPoi(reservationId);
if (!isPoi && reservations[reservationId] != _msgSender()) {
bool _isPoi = isPoi(reservationId);
if (!_isPoi && reservations[reservationId] != _msgSender()) {
revert NotOwningReservation(reservationId);
}

Expand All @@ -134,7 +134,7 @@ contract IPNFT is ERC721URIStorageUpgradeable, ERC721BurnableUpgradeable, IReser
if (!mintAuthorizer.authorizeMint(_msgSender(), to, abi.encode(SignedMintAuthorization(reservationId, _tokenURI, authorization)))) {
revert Unauthorized();
}
if(!isPoi) {
if (!_isPoi) {
delete reservations[reservationId];
}

Expand Down Expand Up @@ -206,7 +206,7 @@ contract IPNFT is ERC721URIStorageUpgradeable, ERC721BurnableUpgradeable, IReser
super._burn(tokenId);
}

function _verifyPoi(uint256 poi) internal pure returns (bool) {
function isPoi(uint256 poi) public pure returns (bool) {
return poi > type(uint128).max;
}

Expand Down
14 changes: 7 additions & 7 deletions subgraph/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ dataSources:
file: ./src/swapMapping.ts
- kind: ethereum/contract
name: Tokenizer
network: mainnet
network: foundry
source:
abi: Tokenizer
address: "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e"
Expand All @@ -84,7 +84,7 @@ dataSources:
file: ./src/tokenizerMapping.ts
- kind: ethereum/contract
name: CrowdSale
network: mainnet
network: foundry
source:
abi: CrowdSale
address: "0x7a2088a1bFc9d81c55368AE168C2C02570cB814F"
Expand Down Expand Up @@ -121,7 +121,7 @@ dataSources:
file: ./src/crowdSaleMapping.ts
- kind: ethereum/contract
name: StakedLockingCrowdSale
network: mainnet
network: foundry
source:
abi: StakedLockingCrowdSale
address: "0x0B306BF915C4d645ff596e518fAf3F9669b97016"
Expand Down Expand Up @@ -167,7 +167,7 @@ dataSources:
file: ./src/stakedLockingCrowdSaleMapping.ts
- kind: ethereum/contract
name: TermsAcceptedPermissioner
network: mainnet
network: foundry
source:
abi: TermsAcceptedPermissioner
address: "0x8A791620dd6260079BF849Dc5567aDC3F2FdC318"
Expand All @@ -188,7 +188,7 @@ dataSources:
templates:
- name: IPToken
kind: ethereum/contract
network: mainnet
network: foundry
source:
abi: IPToken
mapping:
Expand All @@ -208,7 +208,7 @@ templates:
handler: handleCapped
- name: TimelockedToken
kind: ethereum/contract
network: mainnet
network: foundry
source:
abi: TimelockedToken
mapping:
Expand Down Expand Up @@ -240,4 +240,4 @@ templates:
abis:
- name: IPNFT
file: ./abis/IPNFT.json
network: mainnet
network: foundry
2 changes: 1 addition & 1 deletion test/IPNFT.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ contract IPNFTTest is IPNFTMintHelper {

function testVerifyPoi() public {
uint256 tokenId = uint256(0x073cb54264ef688e56531a2d09ab47b14086b5c7813e3a23a2bd7b1bb6458a52);
bool isPoi = verifyPoi(tokenId);
bool isPoi = ipnft.isPoi(tokenId);
assertEq(isPoi, true);
}

Expand Down
4 changes: 0 additions & 4 deletions test/IPNFTMintHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,4 @@ abstract contract IPNFTMintHelper is Test {
vm.stopPrank();
return reservationId;
}

function verifyPoi(uint256 tokenId) public pure returns (bool) {
return tokenId > type(uint128).max;
}
}

0 comments on commit 977706d

Please sign in to comment.