From e6454d0d658affda68e39f9471e91eefe4963f03 Mon Sep 17 00:00:00 2001 From: Volodymyr Lykhonis Date: Fri, 1 Dec 2023 17:51:38 +0100 Subject: [PATCH] Migrate to lsp contract 0.13.0 --- lib/lsp-smart-contracts | 2 +- src/assets/lsp7/GenesisDigitalAsset.sol | 3 ++- src/assets/lsp7/MintableDigitalAsset.sol | 3 ++- .../lsp8/CollectorIdentifiableDigitalAsset.sol | 7 ++++--- .../lsp8/MintableIdentifiableDigitalAsset.sol | 3 ++- src/drops/LSP7DropsDigitalAsset.sol | 3 ++- src/drops/LSP8DropsDigitalAsset.sol | 3 ++- src/page/PageName.sol | 7 ++++--- test/assets/lsp7/DigitalAssetDrop.t.sol | 3 ++- test/assets/lsp7/DigitalAssetMock.sol | 10 +++++++--- test/assets/lsp7/MintableDigitalAsset.t.sol | 8 ++++++-- .../lsp8/CollectorIdentifiableDigitalAsset.t.sol | 13 +++++++++---- .../lsp8/MintableIdentifiableDigitalAsset.t.sol | 2 +- test/marketplace/Participant.t.sol | 2 +- test/marketplace/lsp7/LSP7DigitalAssetMock.sol | 10 +++++++--- test/marketplace/lsp7/LSP7Listings.t.sol | 2 +- test/marketplace/lsp7/LSP7Marketplace.t.sol | 4 ++-- test/marketplace/lsp7/LSP7Offers.t.sol | 2 +- test/marketplace/lsp8/LSP8Auctions.t.sol | 2 +- test/marketplace/lsp8/LSP8DigitalAssetMock.sol | 10 +++++++--- test/marketplace/lsp8/LSP8Listings.t.sol | 2 +- test/marketplace/lsp8/LSP8Marketplace.t.sol | 4 ++-- test/marketplace/lsp8/LSP8Offers.t.sol | 2 +- test/page/PageName.t.sol | 13 +++++++++---- 24 files changed, 77 insertions(+), 43 deletions(-) diff --git a/lib/lsp-smart-contracts b/lib/lsp-smart-contracts index cab33b2..5c559e6 160000 --- a/lib/lsp-smart-contracts +++ b/lib/lsp-smart-contracts @@ -1 +1 @@ -Subproject commit cab33b2b7870c9e717fa6a6467c12e6822b134a1 +Subproject commit 5c559e657686f3c19a4fa323044955ef92fe9d48 diff --git a/src/assets/lsp7/GenesisDigitalAsset.sol b/src/assets/lsp7/GenesisDigitalAsset.sol index f64508b..fe93ad3 100644 --- a/src/assets/lsp7/GenesisDigitalAsset.sol +++ b/src/assets/lsp7/GenesisDigitalAsset.sol @@ -2,6 +2,7 @@ pragma solidity 0.8.17; import {LSP7DigitalAsset} from "@lukso/lsp-smart-contracts/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol"; +import {_LSP4_TOKEN_TYPE_NFT} from "@lukso/lsp-smart-contracts/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol"; contract GenesisDigitalAsset is LSP7DigitalAsset { error InvalidBeneficiary(); @@ -12,7 +13,7 @@ contract GenesisDigitalAsset is LSP7DigitalAsset { address public beneficiary; constructor(string memory name_, string memory symbol_, address newOwner_, address newBeneficiary_) - LSP7DigitalAsset(name_, symbol_, newOwner_, true) + LSP7DigitalAsset(name_, symbol_, newOwner_, _LSP4_TOKEN_TYPE_NFT, true) { _setBeneficiary(newBeneficiary_); } diff --git a/src/assets/lsp7/MintableDigitalAsset.sol b/src/assets/lsp7/MintableDigitalAsset.sol index d3271b6..cfe98da 100644 --- a/src/assets/lsp7/MintableDigitalAsset.sol +++ b/src/assets/lsp7/MintableDigitalAsset.sol @@ -10,9 +10,10 @@ contract MintableDigitalAsset is LSP7Mintable, LSP7CappedSupply { string memory name_, string memory symbol_, address newOwner_, + uint256 lsp4TokenType_, bool isNonDivisible_, uint256 tokenSupplyCap_ - ) LSP7Mintable(name_, symbol_, newOwner_, isNonDivisible_) LSP7CappedSupply(tokenSupplyCap_) {} + ) LSP7Mintable(name_, symbol_, newOwner_, lsp4TokenType_, isNonDivisible_) LSP7CappedSupply(tokenSupplyCap_) {} function _mint(address to, uint256 amount, bool allowNonLSP1Recipient, bytes memory data) internal diff --git a/src/assets/lsp8/CollectorIdentifiableDigitalAsset.sol b/src/assets/lsp8/CollectorIdentifiableDigitalAsset.sol index d69761e..ff7f678 100644 --- a/src/assets/lsp8/CollectorIdentifiableDigitalAsset.sol +++ b/src/assets/lsp8/CollectorIdentifiableDigitalAsset.sol @@ -12,11 +12,12 @@ import {LSP8Enumerable} from "@lukso/lsp-smart-contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol"; import {LSP8IdentifiableDigitalAssetCore} from "@lukso/lsp-smart-contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol"; +import {_LSP8_TOKENID_SCHEMA_UNIQUE_ID} from + "@lukso/lsp-smart-contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol"; +import {_LSP4_TOKEN_TYPE_NFT} from "@lukso/lsp-smart-contracts/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol"; import {Withdrawable} from "../../common/Withdrawable.sol"; import {ICollectorIdentifiableDigitalAsset} from "./ICollectorIdentifiableDigitalAsset.sol"; -uint256 constant _LSP8_TOKEN_ID_TYPE_UNIQUE_IDENTIFIER = 2; - contract CollectorIdentifiableDigitalAsset is ICollectorIdentifiableDigitalAsset, LSP8IdentifiableDigitalAsset, @@ -52,7 +53,7 @@ contract CollectorIdentifiableDigitalAsset is address controller_, uint256 tokenSupplyCap_ ) - LSP8IdentifiableDigitalAsset(name_, symbol_, newOwner_, _LSP8_TOKEN_ID_TYPE_UNIQUE_IDENTIFIER) + LSP8IdentifiableDigitalAsset(name_, symbol_, newOwner_, _LSP4_TOKEN_TYPE_NFT, _LSP8_TOKENID_SCHEMA_UNIQUE_ID) LSP8CappedSupply(tokenSupplyCap_) { _setController(controller_); diff --git a/src/assets/lsp8/MintableIdentifiableDigitalAsset.sol b/src/assets/lsp8/MintableIdentifiableDigitalAsset.sol index 519b7aa..80eb404 100644 --- a/src/assets/lsp8/MintableIdentifiableDigitalAsset.sol +++ b/src/assets/lsp8/MintableIdentifiableDigitalAsset.sol @@ -15,8 +15,9 @@ contract MintableIdentifiableDigitalAsset is LSP8Mintable, LSP8Enumerable, LSP8C string memory symbol_, address newOwner_, uint256 tokenIdType_, + uint256 lsp8TokenIdSchema_, uint256 tokenSupplyCap_ - ) LSP8Mintable(name_, symbol_, newOwner_, tokenIdType_) LSP8CappedSupply(tokenSupplyCap_) { + ) LSP8Mintable(name_, symbol_, newOwner_, tokenIdType_, lsp8TokenIdSchema_) LSP8CappedSupply(tokenSupplyCap_) { // noop } diff --git a/src/drops/LSP7DropsDigitalAsset.sol b/src/drops/LSP7DropsDigitalAsset.sol index d0d3e45..5fdfa78 100644 --- a/src/drops/LSP7DropsDigitalAsset.sol +++ b/src/drops/LSP7DropsDigitalAsset.sol @@ -6,6 +6,7 @@ import { LSP7DigitalAssetCore } from "@lukso/lsp-smart-contracts/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol"; import {LSP7CappedSupply} from "@lukso/lsp-smart-contracts/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol"; +import {_LSP4_TOKEN_TYPE_NFT} from "@lukso/lsp-smart-contracts/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol"; import {DropsDigitalAsset} from "./DropsDigitalAsset.sol"; contract LSP7DropsDigitalAsset is LSP7CappedSupply, DropsDigitalAsset { @@ -20,7 +21,7 @@ contract LSP7DropsDigitalAsset is LSP7CappedSupply, DropsDigitalAsset { uint256 tokenSupplyCap_, uint32 serviceFeePoints_ ) - LSP7DigitalAsset(name_, symbol_, newOwner_, true) + LSP7DigitalAsset(name_, symbol_, newOwner_, _LSP4_TOKEN_TYPE_NFT, true) LSP7CappedSupply(tokenSupplyCap_) DropsDigitalAsset(service_, verifier_, serviceFeePoints_) {} diff --git a/src/drops/LSP8DropsDigitalAsset.sol b/src/drops/LSP8DropsDigitalAsset.sol index e0a19d0..358dad1 100644 --- a/src/drops/LSP8DropsDigitalAsset.sol +++ b/src/drops/LSP8DropsDigitalAsset.sol @@ -9,6 +9,7 @@ import {LSP8CappedSupply} from "@lukso/lsp-smart-contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol"; import {LSP8Enumerable} from "@lukso/lsp-smart-contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol"; +import {_LSP4_TOKEN_TYPE_NFT} from "@lukso/lsp-smart-contracts/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol"; import {DropsDigitalAsset} from "./DropsDigitalAsset.sol"; contract LSP8DropsDigitalAsset is LSP8CappedSupply, LSP8Enumerable, DropsDigitalAsset { @@ -35,7 +36,7 @@ contract LSP8DropsDigitalAsset is LSP8CappedSupply, LSP8Enumerable, DropsDigital uint256 tokenSupplyCap_, uint32 serviceFeePoints_ ) - LSP8IdentifiableDigitalAsset(name_, symbol_, newOwner_, _LSP8_TOKEN_ID_TYPE_UNIQUE_NUMBER) + LSP8IdentifiableDigitalAsset(name_, symbol_, newOwner_, _LSP4_TOKEN_TYPE_NFT, _LSP8_TOKEN_ID_TYPE_UNIQUE_NUMBER) LSP8CappedSupply(tokenSupplyCap_) DropsDigitalAsset(service_, verifier_, serviceFeePoints_) { diff --git a/src/page/PageName.sol b/src/page/PageName.sol index 8ffcdf3..93ccbcd 100644 --- a/src/page/PageName.sol +++ b/src/page/PageName.sol @@ -4,6 +4,9 @@ pragma solidity 0.8.17; import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import {PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; +import {_LSP4_TOKEN_TYPE_NFT} from "@lukso/lsp-smart-contracts/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol"; +import {_LSP8_TOKENID_SCHEMA_STRING} from + "@lukso/lsp-smart-contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol"; import {LSP8EnumerableInitAbstract} from "@lukso/lsp-smart-contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol"; import {LSP8IdentifiableDigitalAssetInitAbstract} from @@ -11,8 +14,6 @@ import {LSP8IdentifiableDigitalAssetInitAbstract} from import {Withdrawable} from "../common/Withdrawable.sol"; import {IPageNameMarketplace, PendingSale} from "./IPageNameMarketplace.sol"; -uint256 constant _LSP8_TOKEN_ID_TYPE_UNIQUE_NAME = 1; - contract PageName is LSP8EnumerableInitAbstract, ReentrancyGuardUpgradeable, PausableUpgradeable, Withdrawable { error InvalidController(); @@ -52,7 +53,7 @@ contract PageName is LSP8EnumerableInitAbstract, ReentrancyGuardUpgradeable, Pau uint16 profileLimit_, IPageNameMarketplace marketplace_ ) external initializer { - super._initialize(name_, symbol_, newOwner_, _LSP8_TOKEN_ID_TYPE_UNIQUE_NAME); + super._initialize(name_, symbol_, newOwner_, _LSP4_TOKEN_TYPE_NFT, _LSP8_TOKENID_SCHEMA_STRING); __ReentrancyGuard_init(); __Pausable_init(); _setBeneficiary(beneficiary_); diff --git a/test/assets/lsp7/DigitalAssetDrop.t.sol b/test/assets/lsp7/DigitalAssetDrop.t.sol index 3e053fa..758fe9d 100644 --- a/test/assets/lsp7/DigitalAssetDrop.t.sol +++ b/test/assets/lsp7/DigitalAssetDrop.t.sol @@ -4,6 +4,7 @@ pragma solidity 0.8.17; import {Test} from "forge-std/Test.sol"; import {Merkle} from "murky/Merkle.sol"; import {UniversalProfile} from "@lukso/lsp-smart-contracts/contracts/UniversalProfile.sol"; +import {_LSP4_TOKEN_TYPE_NFT} from "@lukso/lsp-smart-contracts/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol"; import {DigitalAssetDrop} from "../../../src/assets/lsp7/DigitalAssetDrop.sol"; import {deployProfile} from "../../utils/profile.sol"; import {DigitalAssetMock} from "./DigitalAssetMock.sol"; @@ -24,7 +25,7 @@ contract DigitalAssetDropTest is Test { dropOwner = vm.addr(3); merkle = new Merkle(); - asset = new DigitalAssetMock("Mock", "MCK", assetOwner, true); + asset = new DigitalAssetMock("Mock", "MCK", assetOwner, _LSP4_TOKEN_TYPE_NFT, true); } function test_Claim() public { diff --git a/test/assets/lsp7/DigitalAssetMock.sol b/test/assets/lsp7/DigitalAssetMock.sol index cec8d9a..702c669 100644 --- a/test/assets/lsp7/DigitalAssetMock.sol +++ b/test/assets/lsp7/DigitalAssetMock.sol @@ -4,9 +4,13 @@ pragma solidity 0.8.17; import {LSP7DigitalAsset} from "@lukso/lsp-smart-contracts/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol"; contract DigitalAssetMock is LSP7DigitalAsset { - constructor(string memory name_, string memory symbol_, address newOwner_, bool isNonDivisible_) - LSP7DigitalAsset(name_, symbol_, newOwner_, isNonDivisible_) - {} + constructor( + string memory name_, + string memory symbol_, + address newOwner_, + uint256 lsp4TokenType_, + bool isNonDivisible_ + ) LSP7DigitalAsset(name_, symbol_, newOwner_, lsp4TokenType_, isNonDivisible_) {} function mint(address to, uint256 amount, bool allowNonLSP1Recipient, bytes memory data) external { _mint(to, amount, allowNonLSP1Recipient, data); diff --git a/test/assets/lsp7/MintableDigitalAsset.t.sol b/test/assets/lsp7/MintableDigitalAsset.t.sol index bc59282..9c48b8b 100644 --- a/test/assets/lsp7/MintableDigitalAsset.t.sol +++ b/test/assets/lsp7/MintableDigitalAsset.t.sol @@ -3,6 +3,10 @@ pragma solidity 0.8.17; import {Test} from "forge-std/Test.sol"; import {UniversalProfile} from "@lukso/lsp-smart-contracts/contracts/UniversalProfile.sol"; +import { + _LSP4_TOKEN_TYPE_TOKEN, + _LSP4_TOKEN_TYPE_NFT +} from "@lukso/lsp-smart-contracts/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol"; import {MintableDigitalAsset} from "../../../src/assets/lsp7/MintableDigitalAsset.sol"; contract MintableDigitalAssetTest is Test { @@ -13,7 +17,7 @@ contract MintableDigitalAssetTest is Test { } function test_NonDivisble() public { - MintableDigitalAsset asset = new MintableDigitalAsset("Test", "TST", owner, true, 100); + MintableDigitalAsset asset = new MintableDigitalAsset("Test", "TST", owner, _LSP4_TOKEN_TYPE_NFT, true, 100); assertEq(0, asset.totalSupply()); assertEq(100, asset.tokenSupplyCap()); assertEq(owner, asset.owner()); @@ -21,7 +25,7 @@ contract MintableDigitalAssetTest is Test { } function test_Divisible() public { - MintableDigitalAsset asset = new MintableDigitalAsset("Test", "TST", owner, false, 100); + MintableDigitalAsset asset = new MintableDigitalAsset("Test", "TST", owner, _LSP4_TOKEN_TYPE_TOKEN, false, 100); assertEq(0, asset.totalSupply()); assertEq(100, asset.tokenSupplyCap()); assertEq(owner, asset.owner()); diff --git a/test/assets/lsp8/CollectorIdentifiableDigitalAsset.t.sol b/test/assets/lsp8/CollectorIdentifiableDigitalAsset.t.sol index 53914d5..f2b6a16 100644 --- a/test/assets/lsp8/CollectorIdentifiableDigitalAsset.t.sol +++ b/test/assets/lsp8/CollectorIdentifiableDigitalAsset.t.sol @@ -5,13 +5,17 @@ import {Test} from "forge-std/Test.sol"; import {UniversalProfile} from "@lukso/lsp-smart-contracts/contracts/UniversalProfile.sol"; import { _LSP4_TOKEN_NAME_KEY, - _LSP4_TOKEN_SYMBOL_KEY + _LSP4_TOKEN_SYMBOL_KEY, + _LSP4_TOKEN_TYPE_KEY, + _LSP4_TOKEN_TYPE_NFT } from "@lukso/lsp-smart-contracts/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol"; +import { + _LSP8_TOKENID_SCHEMA_KEY, + _LSP8_TOKENID_SCHEMA_UNIQUE_ID +} from "@lukso/lsp-smart-contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol"; import {CollectorIdentifiableDigitalAsset} from "../../../src/assets/lsp8/CollectorIdentifiableDigitalAsset.sol"; import {deployProfile} from "../../utils/profile.sol"; -bytes32 constant _LSP8_TOKEN_ID_TYPE_KEY = 0x715f248956de7ce65e94d9d836bfead479f7e70d69b718d47bfe7b00e05b4fe4; - contract CollectorIdentifiableDigitalAssetTest is Test { event TokensPurchased(address indexed recipient, bytes32[] tokenIds, uint256 totalPaid); event TokenSupplyLimitChanged(uint256 limit); @@ -35,7 +39,8 @@ contract CollectorIdentifiableDigitalAssetTest is Test { function test_Initialize() public { assertEq("Universal Page Collector", asset.getData(_LSP4_TOKEN_NAME_KEY)); assertEq("UPC", asset.getData(_LSP4_TOKEN_SYMBOL_KEY)); - assertEq(2, /* unuque identifier/sequence */ uint256(bytes32(asset.getData(_LSP8_TOKEN_ID_TYPE_KEY)))); + assertEq(_LSP4_TOKEN_TYPE_NFT, uint256(bytes32(asset.getData(_LSP4_TOKEN_TYPE_KEY)))); + assertEq(_LSP8_TOKENID_SCHEMA_UNIQUE_ID, uint256(bytes32(asset.getData(_LSP8_TOKENID_SCHEMA_KEY)))); assertEq(0, asset.totalSupply()); assertEq(100, asset.tokenSupplyCap()); assertEq(0, asset.tokenSupplyLimit()); diff --git a/test/assets/lsp8/MintableIdentifiableDigitalAsset.t.sol b/test/assets/lsp8/MintableIdentifiableDigitalAsset.t.sol index f70406e..dc60d50 100644 --- a/test/assets/lsp8/MintableIdentifiableDigitalAsset.t.sol +++ b/test/assets/lsp8/MintableIdentifiableDigitalAsset.t.sol @@ -13,7 +13,7 @@ contract MintableIdentifiableDigitalAssetTest is Test { } function test() public { - MintableIdentifiableDigitalAsset asset = new MintableIdentifiableDigitalAsset("Test", "TST", owner, 1, 100); + MintableIdentifiableDigitalAsset asset = new MintableIdentifiableDigitalAsset("Test", "TST", owner, 1, 1, 100); assertEq(0, asset.totalSupply()); assertEq(100, asset.tokenSupplyCap()); assertEq(owner, asset.owner()); diff --git a/test/marketplace/Participant.t.sol b/test/marketplace/Participant.t.sol index 043c9ed..fe925aa 100644 --- a/test/marketplace/Participant.t.sol +++ b/test/marketplace/Participant.t.sol @@ -37,7 +37,7 @@ contract ParticipantTest is Test { controllerKey = 4; controller = vm.addr(controllerKey); - genesisAsset = new LSP7DigitalAssetMock("Mock", "MCK", assetOwner, true); + genesisAsset = new LSP7DigitalAssetMock("Mock", "MCK", assetOwner, 0, true); collectorAsset = new CollectorIdentifiableDigitalAsset("Universal Page Collector", "UPC", assetOwner, controller, 1000); diff --git a/test/marketplace/lsp7/LSP7DigitalAssetMock.sol b/test/marketplace/lsp7/LSP7DigitalAssetMock.sol index c40ea9c..a0d7eb5 100644 --- a/test/marketplace/lsp7/LSP7DigitalAssetMock.sol +++ b/test/marketplace/lsp7/LSP7DigitalAssetMock.sol @@ -4,9 +4,13 @@ pragma solidity 0.8.17; import {LSP7DigitalAsset} from "@lukso/lsp-smart-contracts/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol"; contract LSP7DigitalAssetMock is LSP7DigitalAsset { - constructor(string memory name_, string memory symbol_, address newOwner_, bool isNonDivisible_) - LSP7DigitalAsset(name_, symbol_, newOwner_, isNonDivisible_) - {} + constructor( + string memory name_, + string memory symbol_, + address newOwner_, + uint256 lsp4TokenType_, + bool isNonDivisible_ + ) LSP7DigitalAsset(name_, symbol_, newOwner_, lsp4TokenType_, isNonDivisible_) {} function mint(address to, uint256 amount, bool allowNonLSP1Recipient, bytes memory data) external { _mint(to, amount, allowNonLSP1Recipient, data); diff --git a/test/marketplace/lsp7/LSP7Listings.t.sol b/test/marketplace/lsp7/LSP7Listings.t.sol index 1163a56..3e75830 100644 --- a/test/marketplace/lsp7/LSP7Listings.t.sol +++ b/test/marketplace/lsp7/LSP7Listings.t.sol @@ -44,7 +44,7 @@ contract LSP7ListingsTest is Test { admin = vm.addr(1); owner = vm.addr(2); - asset = new LSP7DigitalAssetMock("Mock", "MCK", owner, true); + asset = new LSP7DigitalAssetMock("Mock", "MCK", owner, 0, true); listings = LSP7Listings( address( diff --git a/test/marketplace/lsp7/LSP7Marketplace.t.sol b/test/marketplace/lsp7/LSP7Marketplace.t.sol index a355a1e..6d9922c 100644 --- a/test/marketplace/lsp7/LSP7Marketplace.t.sol +++ b/test/marketplace/lsp7/LSP7Marketplace.t.sol @@ -50,7 +50,7 @@ contract LSP7MarketplaceTest is Test { owner = vm.addr(2); beneficiary = vm.addr(3); - asset = new LSP7DigitalAssetMock("Mock", "MCK", owner, true); + asset = new LSP7DigitalAssetMock("Mock", "MCK", owner, 0, true); participant = Participant( payable( @@ -208,7 +208,7 @@ contract LSP7MarketplaceTest is Test { } function test_BuyWithDiscount() public { - LSP7DigitalAssetMock discountAsset = new LSP7DigitalAssetMock("Discount", "DSC", owner, true); + LSP7DigitalAssetMock discountAsset = new LSP7DigitalAssetMock("Discount", "DSC", owner, 0, true); vm.prank(owner); participant.setGenesisAsset(discountAsset); diff --git a/test/marketplace/lsp7/LSP7Offers.t.sol b/test/marketplace/lsp7/LSP7Offers.t.sol index da484e1..3b515fe 100644 --- a/test/marketplace/lsp7/LSP7Offers.t.sol +++ b/test/marketplace/lsp7/LSP7Offers.t.sol @@ -30,7 +30,7 @@ contract LSP7OffersTest is Test { admin = vm.addr(1); owner = vm.addr(2); - asset = new LSP7DigitalAssetMock("Mock", "MCK", owner, true); + asset = new LSP7DigitalAssetMock("Mock", "MCK", owner, 0, true); listings = LSP7Listings( address( diff --git a/test/marketplace/lsp8/LSP8Auctions.t.sol b/test/marketplace/lsp8/LSP8Auctions.t.sol index ec44b70..719a93f 100644 --- a/test/marketplace/lsp8/LSP8Auctions.t.sol +++ b/test/marketplace/lsp8/LSP8Auctions.t.sol @@ -59,7 +59,7 @@ contract LSP8AuctionsTest is Test { admin = vm.addr(1); owner = vm.addr(2); - asset = new LSP8DigitalAssetMock("Mock", "MCK", owner, 0); + asset = new LSP8DigitalAssetMock("Mock", "MCK", owner, 0, 0); listings = LSP8Listings( address( diff --git a/test/marketplace/lsp8/LSP8DigitalAssetMock.sol b/test/marketplace/lsp8/LSP8DigitalAssetMock.sol index 8a8d388..8bf7035 100644 --- a/test/marketplace/lsp8/LSP8DigitalAssetMock.sol +++ b/test/marketplace/lsp8/LSP8DigitalAssetMock.sol @@ -5,9 +5,13 @@ import {LSP8IdentifiableDigitalAsset} from "@lukso/lsp-smart-contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol"; contract LSP8DigitalAssetMock is LSP8IdentifiableDigitalAsset { - constructor(string memory name_, string memory symbol_, address newOwner_, uint256 tokenIdType_) - LSP8IdentifiableDigitalAsset(name_, symbol_, newOwner_, tokenIdType_) - { + constructor( + string memory name_, + string memory symbol_, + address newOwner_, + uint256 tokenIdType_, + uint256 lsp8TokenIdSchema_ + ) LSP8IdentifiableDigitalAsset(name_, symbol_, newOwner_, tokenIdType_, lsp8TokenIdSchema_) { // noop } diff --git a/test/marketplace/lsp8/LSP8Listings.t.sol b/test/marketplace/lsp8/LSP8Listings.t.sol index 1654140..529f376 100644 --- a/test/marketplace/lsp8/LSP8Listings.t.sol +++ b/test/marketplace/lsp8/LSP8Listings.t.sol @@ -36,7 +36,7 @@ contract LSP8ListingsTest is Test { admin = vm.addr(1); owner = vm.addr(2); - asset = new LSP8DigitalAssetMock("Mock", "MCK", owner, 0); + asset = new LSP8DigitalAssetMock("Mock", "MCK", owner, 0, 0); listings = LSP8Listings( address( diff --git a/test/marketplace/lsp8/LSP8Marketplace.t.sol b/test/marketplace/lsp8/LSP8Marketplace.t.sol index 91e30fa..88b9cf4 100644 --- a/test/marketplace/lsp8/LSP8Marketplace.t.sol +++ b/test/marketplace/lsp8/LSP8Marketplace.t.sol @@ -53,7 +53,7 @@ contract LSP8MarketplaceTest is Test { owner = vm.addr(2); beneficiary = vm.addr(3); - asset = new LSP8DigitalAssetMock("Mock", "MCK", owner, 0); + asset = new LSP8DigitalAssetMock("Mock", "MCK", owner, 0, 0); participant = Participant( payable( @@ -218,7 +218,7 @@ contract LSP8MarketplaceTest is Test { } function test_BuyWithDiscount() public { - LSP7DigitalAssetMock discountAsset = new LSP7DigitalAssetMock("Discount", "DSC", owner, true); + LSP7DigitalAssetMock discountAsset = new LSP7DigitalAssetMock("Discount", "DSC", owner, 0, true); vm.prank(owner); participant.setGenesisAsset(discountAsset); diff --git a/test/marketplace/lsp8/LSP8Offers.t.sol b/test/marketplace/lsp8/LSP8Offers.t.sol index d4ee08b..164beee 100644 --- a/test/marketplace/lsp8/LSP8Offers.t.sol +++ b/test/marketplace/lsp8/LSP8Offers.t.sol @@ -30,7 +30,7 @@ contract LSP8OffersTest is Test { admin = vm.addr(1); owner = vm.addr(2); - asset = new LSP8DigitalAssetMock("Mock", "MCK", owner, 0); + asset = new LSP8DigitalAssetMock("Mock", "MCK", owner, 0, 0); listings = LSP8Listings( address( diff --git a/test/page/PageName.t.sol b/test/page/PageName.t.sol index fd5d82b..60ad57e 100644 --- a/test/page/PageName.t.sol +++ b/test/page/PageName.t.sol @@ -5,16 +5,20 @@ import {Test} from "forge-std/Test.sol"; import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; import { _LSP4_TOKEN_NAME_KEY, - _LSP4_TOKEN_SYMBOL_KEY + _LSP4_TOKEN_SYMBOL_KEY, + _LSP4_TOKEN_TYPE_KEY, + _LSP4_TOKEN_TYPE_NFT } from "@lukso/lsp-smart-contracts/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol"; +import { + _LSP8_TOKENID_SCHEMA_KEY, + _LSP8_TOKENID_SCHEMA_STRING +} from "@lukso/lsp-smart-contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol"; import {UniversalProfile} from "@lukso/lsp-smart-contracts/contracts/UniversalProfile.sol"; import {IPageNameMarketplace, PendingSale} from "../../src/page/IPageNameMarketplace.sol"; import {PageName} from "../../src/page/PageName.sol"; import {deployProfile} from "../utils/profile.sol"; import {PageNameMarketplaceMock} from "./PageNameMarketplaceMock.sol"; -bytes32 constant _LSP8_TOKEN_ID_TYPE_KEY = 0x715f248956de7ce65e94d9d836bfead479f7e70d69b718d47bfe7b00e05b4fe4; - contract PageNameTest is Test { event ValueReceived(address indexed sender, uint256 indexed value); event ValueWithdrawn(address indexed sender, uint256 indexed value); @@ -63,7 +67,8 @@ contract PageNameTest is Test { assertTrue(!name.paused()); assertEq("Universal Page Name", name.getData(_LSP4_TOKEN_NAME_KEY)); assertEq("UPN", name.getData(_LSP4_TOKEN_SYMBOL_KEY)); - assertEq(1, /* string */ uint256(bytes32(name.getData(_LSP8_TOKEN_ID_TYPE_KEY)))); + assertEq(_LSP4_TOKEN_TYPE_NFT, uint256(bytes32(name.getData(_LSP4_TOKEN_TYPE_KEY)))); + assertEq(_LSP8_TOKENID_SCHEMA_STRING, uint256(bytes32(name.getData(_LSP8_TOKENID_SCHEMA_KEY)))); assertEq(owner, name.owner()); assertEq(beneficiary, name.beneficiary()); assertEq(controller, name.controller());