git.delta.rocks / unique-network / refs/commits / ab8fc135746e

difftreelog

Change prefixed names to postfixed

Trubnikov Sergey2023-04-17parent: #b77279f.patch.diff
in: master

14 files changed

modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
746 .collect::<String>()746 .collect::<String>()
747 }747 }
748
749 /// Returns the owner (in cross format) of the token.
750 ///
751 /// @param tokenId Id for the token.
752 #[solidity(hide)]
753 fn cross_owner_of(&self, token_id: U256) -> Result<eth::CrossAddress> {
754 Self::owner_of_cross(&self, token_id)
755 }
748756
749 /// Returns the owner (in cross format) of the token.757 /// Returns the owner (in cross format) of the token.
750 ///758 ///
751 /// @param tokenId Id for the token.759 /// @param tokenId Id for the token.
752 fn cross_owner_of(&self, token_id: U256) -> Result<eth::CrossAddress> {760 fn owner_of_cross(&self, token_id: U256) -> Result<eth::CrossAddress> {
753 Self::token_owner(&self, token_id.try_into()?)761 Self::token_owner(&self, token_id.try_into()?)
754 .map(|o| eth::CrossAddress::from_sub_cross_account::<T>(&o))762 .map(|o| eth::CrossAddress::from_sub_cross_account::<T>(&o))
755 .map_err(|_| Error::Revert("token not found".into()))763 .map_err(|_| Error::Revert("token not found".into()))
756 }764 }
757765
758 /// @notice Count all NFTs assigned to an owner766 /// @notice Count all NFTs assigned to an owner
759 /// @dev NFTs assigned to the zero address are considered invalid, and this
760 /// function throws for queries about the zero address.
761 /// @param owner An cross address for whom to query the balance767 /// @param owner An cross address for whom to query the balance
762 /// @return The number of NFTs owned by `owner`, possibly zero768 /// @return The number of NFTs owned by `owner`, possibly zero
763 fn cross_balance_of(&self, owner: eth::CrossAddress) -> Result<U256> {769 fn balance_of_cross(&self, owner: eth::CrossAddress) -> Result<U256> {
764 self.consume_store_reads(1)?;770 self.consume_store_reads(1)?;
765 let balance = <AccountBalance<T>>::get((self.id, owner.into_sub_cross_account::<T>()?));771 let balance = <AccountBalance<T>>::get((self.id, owner.into_sub_cross_account::<T>()?));
766 Ok(balance.into())772 Ok(balance.into())
modifiedpallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth
774}774}
775775
776/// @title Unique extensions for ERC721.776/// @title Unique extensions for ERC721.
777/// @dev the ERC-165 identifier for this interface is 0x323b1db8777/// @dev the ERC-165 identifier for this interface is 0x307b061a
778contract ERC721UniqueExtensions is Dummy, ERC165 {778contract ERC721UniqueExtensions is Dummy, ERC165 {
779 /// @notice A descriptive name for a collection of NFTs in this contract779 /// @notice A descriptive name for a collection of NFTs in this contract
780 /// @dev EVM selector for this function is: 0x06fdde03,780 /// @dev EVM selector for this function is: 0x06fdde03,
803 return "";803 return "";
804 }804 }
805
806 // /// Returns the owner (in cross format) of the token.
807 // ///
808 // /// @param tokenId Id for the token.
809 // /// @dev EVM selector for this function is: 0x2b29dace,
810 // /// or in textual repr: crossOwnerOf(uint256)
811 // function crossOwnerOf(uint256 tokenId) public view returns (CrossAddress memory) {
812 // require(false, stub_error);
813 // tokenId;
814 // dummy;
815 // return CrossAddress(0x0000000000000000000000000000000000000000,0);
816 // }
805817
806 /// Returns the owner (in cross format) of the token.818 /// Returns the owner (in cross format) of the token.
807 ///819 ///
808 /// @param tokenId Id for the token.820 /// @param tokenId Id for the token.
809 /// @dev EVM selector for this function is: 0x2b29dace,821 /// @dev EVM selector for this function is: 0xcaa3a4d0,
810 /// or in textual repr: crossOwnerOf(uint256)822 /// or in textual repr: ownerOfCross(uint256)
811 function crossOwnerOf(uint256 tokenId) public view returns (CrossAddress memory) {823 function ownerOfCross(uint256 tokenId) public view returns (CrossAddress memory) {
812 require(false, stub_error);824 require(false, stub_error);
813 tokenId;825 tokenId;
814 dummy;826 dummy;
815 return CrossAddress(0x0000000000000000000000000000000000000000, 0);827 return CrossAddress(0x0000000000000000000000000000000000000000, 0);
816 }828 }
817829
818 /// @notice Count all NFTs assigned to an owner830 /// @notice Count all NFTs assigned to an owner
819 /// @dev NFTs assigned to the zero address are considered invalid, and this
820 /// function throws for queries about the zero address.
821 /// @param owner An cross address for whom to query the balance831 /// @param owner An cross address for whom to query the balance
822 /// @return The number of NFTs owned by `owner`, possibly zero832 /// @return The number of NFTs owned by `owner`, possibly zero
823 /// @dev EVM selector for this function is: 0x24e52cea,833 /// @dev EVM selector for this function is: 0xec069398,
824 /// or in textual repr: crossBalanceOf((address,uint256))834 /// or in textual repr: balanceOfCross((address,uint256))
825 function crossBalanceOf(CrossAddress memory owner) public view returns (uint256) {835 function balanceOfCross(CrossAddress memory owner) public view returns (uint256) {
826 require(false, stub_error);836 require(false, stub_error);
827 owner;837 owner;
828 dummy;838 dummy;
modifiedpallets/refungible/src/erc.rsdiffbeforeafterboth
780 .collect::<String>())780 .collect::<String>())
781 }781 }
782
783 /// Returns the owner (in cross format) of the token.
784 ///
785 /// @param tokenId Id for the token.
786 #[solidity(hide)]
787 fn cross_owner_of(&self, token_id: U256) -> Result<eth::CrossAddress> {
788 Self::owner_of_cross(&self, token_id)
789 }
782790
783 /// Returns the owner (in cross format) of the token.791 /// Returns the owner (in cross format) of the token.
784 ///792 ///
785 /// @param tokenId Id for the token.793 /// @param tokenId Id for the token.
786 fn cross_owner_of(&self, token_id: U256) -> Result<eth::CrossAddress> {794 fn owner_of_cross(&self, token_id: U256) -> Result<eth::CrossAddress> {
787 Self::token_owner(&self, token_id.try_into()?)795 Self::token_owner(&self, token_id.try_into()?)
788 .map(|o| eth::CrossAddress::from_sub_cross_account::<T>(&o))796 .map(|o| eth::CrossAddress::from_sub_cross_account::<T>(&o))
789 .or_else(|err| match err {797 .or_else(|err| match err {
795 }803 }
796804
797 /// @notice Count all RFTs assigned to an owner805 /// @notice Count all RFTs assigned to an owner
798 /// @dev RFTs assigned to the zero address are considered invalid, and this
799 /// function throws for queries about the zero address.
800 /// @param owner An cross address for whom to query the balance806 /// @param owner An cross address for whom to query the balance
801 /// @return The number of RFTs owned by `owner`, possibly zero807 /// @return The number of RFTs owned by `owner`, possibly zero
802 fn cross_balance_of(&self, owner: eth::CrossAddress) -> Result<U256> {808 fn balance_of_cross(&self, owner: eth::CrossAddress) -> Result<U256> {
803 self.consume_store_reads(1)?;809 self.consume_store_reads(1)?;
804 let balance = <AccountBalance<T>>::get((self.id, owner.into_sub_cross_account::<T>()?));810 let balance = <AccountBalance<T>>::get((self.id, owner.into_sub_cross_account::<T>()?));
805 Ok(balance.into())811 Ok(balance.into())
modifiedpallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth
774}774}
775775
776/// @title Unique extensions for ERC721.776/// @title Unique extensions for ERC721.
777/// @dev the ERC-165 identifier for this interface is 0x9780edce777/// @dev the ERC-165 identifier for this interface is 0x95c0f66c
778contract ERC721UniqueExtensions is Dummy, ERC165 {778contract ERC721UniqueExtensions is Dummy, ERC165 {
779 /// @notice A descriptive name for a collection of NFTs in this contract779 /// @notice A descriptive name for a collection of NFTs in this contract
780 /// @dev EVM selector for this function is: 0x06fdde03,780 /// @dev EVM selector for this function is: 0x06fdde03,
803 return "";803 return "";
804 }804 }
805
806 // /// Returns the owner (in cross format) of the token.
807 // ///
808 // /// @param tokenId Id for the token.
809 // /// @dev EVM selector for this function is: 0x2b29dace,
810 // /// or in textual repr: crossOwnerOf(uint256)
811 // function crossOwnerOf(uint256 tokenId) public view returns (CrossAddress memory) {
812 // require(false, stub_error);
813 // tokenId;
814 // dummy;
815 // return CrossAddress(0x0000000000000000000000000000000000000000,0);
816 // }
805817
806 /// Returns the owner (in cross format) of the token.818 /// Returns the owner (in cross format) of the token.
807 ///819 ///
808 /// @param tokenId Id for the token.820 /// @param tokenId Id for the token.
809 /// @dev EVM selector for this function is: 0x2b29dace,821 /// @dev EVM selector for this function is: 0xcaa3a4d0,
810 /// or in textual repr: crossOwnerOf(uint256)822 /// or in textual repr: ownerOfCross(uint256)
811 function crossOwnerOf(uint256 tokenId) public view returns (CrossAddress memory) {823 function ownerOfCross(uint256 tokenId) public view returns (CrossAddress memory) {
812 require(false, stub_error);824 require(false, stub_error);
813 tokenId;825 tokenId;
814 dummy;826 dummy;
815 return CrossAddress(0x0000000000000000000000000000000000000000, 0);827 return CrossAddress(0x0000000000000000000000000000000000000000, 0);
816 }828 }
817829
818 /// @notice Count all RFTs assigned to an owner830 /// @notice Count all RFTs assigned to an owner
819 /// @dev RFTs assigned to the zero address are considered invalid, and this
820 /// function throws for queries about the zero address.
821 /// @param owner An cross address for whom to query the balance831 /// @param owner An cross address for whom to query the balance
822 /// @return The number of RFTs owned by `owner`, possibly zero832 /// @return The number of RFTs owned by `owner`, possibly zero
823 /// @dev EVM selector for this function is: 0x24e52cea,833 /// @dev EVM selector for this function is: 0xec069398,
824 /// or in textual repr: crossBalanceOf((address,uint256))834 /// or in textual repr: balanceOfCross((address,uint256))
825 function crossBalanceOf(CrossAddress memory owner) public view returns (uint256) {835 function balanceOfCross(CrossAddress memory owner) public view returns (uint256) {
826 require(false, stub_error);836 require(false, stub_error);
827 owner;837 owner;
828 dummy;838 dummy;
modifiedruntime/common/ethereum/sponsoring/refungible.rsdiffbeforeafterboth
227 | Symbol227 | Symbol
228 | Description228 | Description
229 | CrossOwnerOf { .. }229 | CrossOwnerOf { .. }
230 | OwnerOfCross { .. }
230 | CrossBalanceOf { .. }231 | BalanceOfCross { .. }
231 | Properties { .. }232 | Properties { .. }
232 | NextTokenId233 | NextTokenId
233 | TokenContractAddress { .. }234 | TokenContractAddress { .. }
modifiedtests/src/eth/abi/nonFungible.jsondiffbeforeafterboth
175 "stateMutability": "view",175 "stateMutability": "view",
176 "type": "function"176 "type": "function"
177 },177 },
178 {
179 "inputs": [
180 {
181 "components": [
182 { "internalType": "address", "name": "eth", "type": "address" },
183 { "internalType": "uint256", "name": "sub", "type": "uint256" }
184 ],
185 "internalType": "struct CrossAddress",
186 "name": "owner",
187 "type": "tuple"
188 }
189 ],
190 "name": "balanceOfCross",
191 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
192 "stateMutability": "view",
193 "type": "function"
194 },
178 {195 {
179 "inputs": [196 "inputs": [
180 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }197 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
384 "stateMutability": "view",401 "stateMutability": "view",
385 "type": "function"402 "type": "function"
386 },403 },
387 {
388 "inputs": [
389 {
390 "components": [
391 { "internalType": "address", "name": "eth", "type": "address" },
392 { "internalType": "uint256", "name": "sub", "type": "uint256" }
393 ],
394 "internalType": "struct CrossAddress",
395 "name": "owner",
396 "type": "tuple"
397 }
398 ],
399 "name": "crossBalanceOf",
400 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
401 "stateMutability": "view",
402 "type": "function"
403 },
404 {
405 "inputs": [
406 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
407 ],
408 "name": "crossOwnerOf",
409 "outputs": [
410 {
411 "components": [
412 { "internalType": "address", "name": "eth", "type": "address" },
413 { "internalType": "uint256", "name": "sub", "type": "uint256" }
414 ],
415 "internalType": "struct CrossAddress",
416 "name": "",
417 "type": "tuple"
418 }
419 ],
420 "stateMutability": "view",
421 "type": "function"
422 },
423 {404 {
424 "inputs": [405 "inputs": [
425 { "internalType": "string[]", "name": "keys", "type": "string[]" }406 { "internalType": "string[]", "name": "keys", "type": "string[]" }
555 "stateMutability": "view",536 "stateMutability": "view",
556 "type": "function"537 "type": "function"
557 },538 },
539 {
540 "inputs": [
541 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
542 ],
543 "name": "ownerOfCross",
544 "outputs": [
545 {
546 "components": [
547 { "internalType": "address", "name": "eth", "type": "address" },
548 { "internalType": "uint256", "name": "sub", "type": "uint256" }
549 ],
550 "internalType": "struct CrossAddress",
551 "name": "",
552 "type": "tuple"
553 }
554 ],
555 "stateMutability": "view",
556 "type": "function"
557 },
558 {558 {
559 "inputs": [559 "inputs": [
560 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },560 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
modifiedtests/src/eth/abi/reFungible.jsondiffbeforeafterboth
157 "stateMutability": "view",157 "stateMutability": "view",
158 "type": "function"158 "type": "function"
159 },159 },
160 {
161 "inputs": [
162 {
163 "components": [
164 { "internalType": "address", "name": "eth", "type": "address" },
165 { "internalType": "uint256", "name": "sub", "type": "uint256" }
166 ],
167 "internalType": "struct CrossAddress",
168 "name": "owner",
169 "type": "tuple"
170 }
171 ],
172 "name": "balanceOfCross",
173 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
174 "stateMutability": "view",
175 "type": "function"
176 },
160 {177 {
161 "inputs": [178 "inputs": [
162 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }179 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
366 "stateMutability": "view",383 "stateMutability": "view",
367 "type": "function"384 "type": "function"
368 },385 },
369 {
370 "inputs": [
371 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
372 ],
373 "name": "crossOwnerOf",
374 "outputs": [
375 {
376 "components": [
377 { "internalType": "address", "name": "eth", "type": "address" },
378 { "internalType": "uint256", "name": "sub", "type": "uint256" }
379 ],
380 "internalType": "struct CrossAddress",
381 "name": "",
382 "type": "tuple"
383 }
384 ],
385 "stateMutability": "view",
386 "type": "function"
387 },
388 {386 {
389 "inputs": [387 "inputs": [
390 { "internalType": "string[]", "name": "keys", "type": "string[]" }388 { "internalType": "string[]", "name": "keys", "type": "string[]" }
520 "stateMutability": "view",518 "stateMutability": "view",
521 "type": "function"519 "type": "function"
522 },520 },
521 {
522 "inputs": [
523 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
524 ],
525 "name": "ownerOfCross",
526 "outputs": [
527 {
528 "components": [
529 { "internalType": "address", "name": "eth", "type": "address" },
530 { "internalType": "uint256", "name": "sub", "type": "uint256" }
531 ],
532 "internalType": "struct CrossAddress",
533 "name": "",
534 "type": "tuple"
535 }
536 ],
537 "stateMutability": "view",
538 "type": "function"
539 },
523 {540 {
524 "inputs": [541 "inputs": [
525 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },542 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
533}533}
534534
535/// @title Unique extensions for ERC721.535/// @title Unique extensions for ERC721.
536/// @dev the ERC-165 identifier for this interface is 0x323b1db8536/// @dev the ERC-165 identifier for this interface is 0x307b061a
537interface ERC721UniqueExtensions is Dummy, ERC165 {537interface ERC721UniqueExtensions is Dummy, ERC165 {
538 /// @notice A descriptive name for a collection of NFTs in this contract538 /// @notice A descriptive name for a collection of NFTs in this contract
539 /// @dev EVM selector for this function is: 0x06fdde03,539 /// @dev EVM selector for this function is: 0x06fdde03,
550 /// or in textual repr: description()550 /// or in textual repr: description()
551 function description() external view returns (string memory);551 function description() external view returns (string memory);
552
553 // /// Returns the owner (in cross format) of the token.
554 // ///
555 // /// @param tokenId Id for the token.
556 // /// @dev EVM selector for this function is: 0x2b29dace,
557 // /// or in textual repr: crossOwnerOf(uint256)
558 // function crossOwnerOf(uint256 tokenId) external view returns (CrossAddress memory);
552559
553 /// Returns the owner (in cross format) of the token.560 /// Returns the owner (in cross format) of the token.
554 ///561 ///
555 /// @param tokenId Id for the token.562 /// @param tokenId Id for the token.
556 /// @dev EVM selector for this function is: 0x2b29dace,563 /// @dev EVM selector for this function is: 0xcaa3a4d0,
557 /// or in textual repr: crossOwnerOf(uint256)564 /// or in textual repr: ownerOfCross(uint256)
558 function crossOwnerOf(uint256 tokenId) external view returns (CrossAddress memory);565 function ownerOfCross(uint256 tokenId) external view returns (CrossAddress memory);
559566
560 /// @notice Count all NFTs assigned to an owner567 /// @notice Count all NFTs assigned to an owner
561 /// @dev NFTs assigned to the zero address are considered invalid, and this
562 /// function throws for queries about the zero address.
563 /// @param owner An cross address for whom to query the balance568 /// @param owner An cross address for whom to query the balance
564 /// @return The number of NFTs owned by `owner`, possibly zero569 /// @return The number of NFTs owned by `owner`, possibly zero
565 /// @dev EVM selector for this function is: 0x24e52cea,570 /// @dev EVM selector for this function is: 0xec069398,
566 /// or in textual repr: crossBalanceOf((address,uint256))571 /// or in textual repr: balanceOfCross((address,uint256))
567 function crossBalanceOf(CrossAddress memory owner) external view returns (uint256);572 function balanceOfCross(CrossAddress memory owner) external view returns (uint256);
568573
569 /// Returns the token properties.574 /// Returns the token properties.
570 ///575 ///
modifiedtests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth
533}533}
534534
535/// @title Unique extensions for ERC721.535/// @title Unique extensions for ERC721.
536/// @dev the ERC-165 identifier for this interface is 0x9780edce536/// @dev the ERC-165 identifier for this interface is 0x95c0f66c
537interface ERC721UniqueExtensions is Dummy, ERC165 {537interface ERC721UniqueExtensions is Dummy, ERC165 {
538 /// @notice A descriptive name for a collection of NFTs in this contract538 /// @notice A descriptive name for a collection of NFTs in this contract
539 /// @dev EVM selector for this function is: 0x06fdde03,539 /// @dev EVM selector for this function is: 0x06fdde03,
550 /// or in textual repr: description()550 /// or in textual repr: description()
551 function description() external view returns (string memory);551 function description() external view returns (string memory);
552
553 // /// Returns the owner (in cross format) of the token.
554 // ///
555 // /// @param tokenId Id for the token.
556 // /// @dev EVM selector for this function is: 0x2b29dace,
557 // /// or in textual repr: crossOwnerOf(uint256)
558 // function crossOwnerOf(uint256 tokenId) external view returns (CrossAddress memory);
552559
553 /// Returns the owner (in cross format) of the token.560 /// Returns the owner (in cross format) of the token.
554 ///561 ///
555 /// @param tokenId Id for the token.562 /// @param tokenId Id for the token.
556 /// @dev EVM selector for this function is: 0x2b29dace,563 /// @dev EVM selector for this function is: 0xcaa3a4d0,
557 /// or in textual repr: crossOwnerOf(uint256)564 /// or in textual repr: ownerOfCross(uint256)
558 function crossOwnerOf(uint256 tokenId) external view returns (CrossAddress memory);565 function ownerOfCross(uint256 tokenId) external view returns (CrossAddress memory);
559566
560 /// @notice Count all RFTs assigned to an owner567 /// @notice Count all RFTs assigned to an owner
561 /// @dev RFTs assigned to the zero address are considered invalid, and this
562 /// function throws for queries about the zero address.
563 /// @param owner An cross address for whom to query the balance568 /// @param owner An cross address for whom to query the balance
564 /// @return The number of RFTs owned by `owner`, possibly zero569 /// @return The number of RFTs owned by `owner`, possibly zero
565 /// @dev EVM selector for this function is: 0x24e52cea,570 /// @dev EVM selector for this function is: 0xec069398,
566 /// or in textual repr: crossBalanceOf((address,uint256))571 /// or in textual repr: balanceOfCross((address,uint256))
567 function crossBalanceOf(CrossAddress memory owner) external view returns (uint256);572 function balanceOfCross(CrossAddress memory owner) external view returns (uint256);
568573
569 /// Returns the token properties.574 /// Returns the token properties.
570 ///575 ///
modifiedtests/src/eth/nonFungible.test.tsdiffbeforeafterboth
663 await expect(collectionEvm.methods[testCase](receiver, 999999).send({from: sender})).to.be.rejected;663 await expect(collectionEvm.methods[testCase](receiver, 999999).send({from: sender})).to.be.rejected;
664 }));664 }));
665665
666 itEth('Check crossBalanceOf()', async ({helper}) => {666 itEth('Check balanceOfCross()', async ({helper}) => {
667 const collection = await helper.nft.mintCollection(minter, {});667 const collection = await helper.nft.mintCollection(minter, {});
668 const owner = await helper.ethCrossAccount.createAccountWithBalance(donor);668 const owner = await helper.ethCrossAccount.createAccountWithBalance(donor);
669 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);669 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
670 const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner.eth);670 const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner.eth);
671671
672 expect(BigInt(await collectionEvm.methods.crossBalanceOf(owner).call({from: owner.eth})) === 0n).to.be.true;672 expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === 0n).to.be.true;
673673
674 for (let i = 1n; i < 100n; i++) {674 for (let i = 1n; i < 100n; i++) {
675 await collection.mintToken(minter, {Ethereum: owner.eth});675 await collection.mintToken(minter, {Ethereum: owner.eth});
676 expect(BigInt(await collectionEvm.methods.crossBalanceOf(owner).call({from: owner.eth})) === i).to.be.true;676 expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === i).to.be.true;
677 }677 }
678 });678 });
679679
680 itEth('Check crossOwnerOf()', async ({helper}) => {680 itEth('Check ownerOfCross()', async ({helper}) => {
681 const collection = await helper.nft.mintCollection(minter, {});681 const collection = await helper.nft.mintCollection(minter, {});
682 let owner = await helper.ethCrossAccount.createAccountWithBalance(donor);682 let owner = await helper.ethCrossAccount.createAccountWithBalance(donor);
683 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);683 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
684 const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner.eth);684 const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner.eth);
685 const {tokenId} = await collection.mintToken(minter, {Ethereum: owner.eth});685 const {tokenId} = await collection.mintToken(minter, {Ethereum: owner.eth});
686686
687 for (let i = 1n; i < 100n; i++) {687 for (let i = 1n; i < 100n; i++) {
688 const ownerCross = await collectionEvm.methods.crossOwnerOf(tokenId).call({from: owner.eth});688 const ownerCross = await collectionEvm.methods.ownerOfCross(tokenId).call({from: owner.eth});
689 expect(ownerCross.eth).to.be.eq(owner.eth);689 expect(ownerCross.eth).to.be.eq(owner.eth);
690 expect(ownerCross.sub).to.be.eq(owner.sub);690 expect(ownerCross.sub).to.be.eq(owner.sub);
691691
modifiedtests/src/eth/reFungible.test.tsdiffbeforeafterboth
591 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);591 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
592 const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner.eth);592 const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner.eth);
593593
594 expect(BigInt(await collectionEvm.methods.crossBalanceOf(owner).call({from: owner.eth})) === 0n).to.be.true;594 expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === 0n).to.be.true;
595595
596 for (let i = 1n; i < 100n; i++) {596 for (let i = 1n; i < 100n; i++) {
597 await collection.mintToken(minter, 100n, {Ethereum: owner.eth});597 await collection.mintToken(minter, 100n, {Ethereum: owner.eth});
598 expect(BigInt(await collectionEvm.methods.crossBalanceOf(owner).call({from: owner.eth})) === i).to.be.true;598 expect(BigInt(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})) === i).to.be.true;
599 }599 }
600 });600 });
601601
602 itEth.only('Check crossOwnerOf()', async ({helper}) => {602 itEth('Check ownerOfCross()', async ({helper}) => {
603 const collection = await helper.rft.mintCollection(minter, {});603 const collection = await helper.rft.mintCollection(minter, {});
604 let owner = await helper.ethCrossAccount.createAccountWithBalance(donor);604 let owner = await helper.ethCrossAccount.createAccountWithBalance(donor);
605 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);605 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
606 const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner.eth);606 const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner.eth);
607 const {tokenId} = await collection.mintToken(minter, 100n,{Ethereum: owner.eth});607 const {tokenId} = await collection.mintToken(minter, 100n,{Ethereum: owner.eth});
608608
609 for (let i = 1n; i < 100n; i++) {609 for (let i = 1n; i < 100n; i++) {
610 const ownerCross = await collectionEvm.methods.crossOwnerOf(tokenId).call({from: owner.eth});610 const ownerCross = await collectionEvm.methods.ownerOfCross(tokenId).call({from: owner.eth});
611 expect(ownerCross.eth).to.be.eq(owner.eth);611 expect(ownerCross.eth).to.be.eq(owner.eth);
612 expect(ownerCross.sub).to.be.eq(owner.sub);612 expect(ownerCross.sub).to.be.eq(owner.sub);
613613
620 const tokenContract = await helper.ethNativeContract.rftToken(tokenAddress, owner.eth, true);620 const tokenContract = await helper.ethNativeContract.rftToken(tokenAddress, owner.eth, true);
621 const newOwner = await helper.ethCrossAccount.createAccountWithBalance(donor);621 const newOwner = await helper.ethCrossAccount.createAccountWithBalance(donor);
622 await tokenContract.methods.transferCross(newOwner, 50).send({from: owner.eth});622 await tokenContract.methods.transferCross(newOwner, 50).send({from: owner.eth});
623 const ownerCross = await collectionEvm.methods.crossOwnerOf(tokenId).call({from: owner.eth});623 const ownerCross = await collectionEvm.methods.ownerOfCross(tokenId).call({from: owner.eth});
624 expect(ownerCross.eth.toUpperCase()).to.be.eq('0XFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF');624 expect(ownerCross.eth.toUpperCase()).to.be.eq('0XFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF');
625 expect(ownerCross.sub).to.be.eq('0');625 expect(ownerCross.sub).to.be.eq('0');
626 });626 });
modifiedtests/src/eth/tokens/minting.test.tsdiffbeforeafterboth
19import {expect, itEth, usingEthPlaygrounds} from '../util';19import {expect, itEth, usingEthPlaygrounds} from '../util';
2020
2121
22describe('Minting tokens', () => {22describe.only('Minting tokens', () => {
23 let donor: IKeyringPair;23 let donor: IKeyringPair;
24 let alice: IKeyringPair;24 let alice: IKeyringPair;
2525
63 const tokenId = event.returnValues.tokenId;63 const tokenId = event.returnValues.tokenId;
64 expect(tokenId).to.be.equal('1');64 expect(tokenId).to.be.equal('1');
65 expect(await helper.collection.getLastTokenId(collection.collectionId)).to.eq(1);65 expect(await helper.collection.getLastTokenId(collection.collectionId)).to.eq(1);
66 expect(await contract.methods.crossOwnerOf(tokenId).call()).to.be.like([receiver, '0']);66 expect(await contract.methods.ownerOfCross(tokenId).call()).to.be.like([receiver, '0']);
67 }67 }
68 });68 });
69 });69 });
97 const tokenId = event.returnValues.tokenId;97 const tokenId = event.returnValues.tokenId;
98 expect(tokenId).to.be.equal('1');98 expect(tokenId).to.be.equal('1');
99 expect(await helper.collection.getLastTokenId(collectionId)).to.eq(1);99 expect(await helper.collection.getLastTokenId(collectionId)).to.eq(1);
100 expect(await collection.methods.crossOwnerOf(tokenId).call()).to.be.like([receiver, '0']);100 expect(await collection.methods.ownerOfCross(tokenId).call()).to.be.like([receiver, '0']);
101 }101 }
102 });102 });
103 });103 });
131 const tokenId = event.returnValues.tokenId;131 const tokenId = event.returnValues.tokenId;
132 expect(tokenId).to.be.equal('1');132 expect(tokenId).to.be.equal('1');
133 expect(await helper.collection.getLastTokenId(collectionId)).to.eq(1);133 expect(await helper.collection.getLastTokenId(collectionId)).to.eq(1);
134 expect(await collection.methods.crossOwnerOf(tokenId).call()).to.be.like([receiver, '0']);134 expect(await collection.methods.ownerOfCross(tokenId).call()).to.be.like([receiver, '0']);
135 }135 }
136 });136 });
137 });137 });
157 expect(event.returnValues.to).to.be.equal(receiver);157 expect(event.returnValues.to).to.be.equal(receiver);
158158
159 expect(await contract.methods.tokenURI(tokenId).call()).to.be.equal('Test URI');159 expect(await contract.methods.tokenURI(tokenId).call()).to.be.equal('Test URI');
160 expect(await contract.methods.crossOwnerOf(tokenId).call()).to.be.like([receiver, '0']);160 expect(await contract.methods.ownerOfCross(tokenId).call()).to.be.like([receiver, '0']);
161 // TODO: this wont work right now, need release 919000 first161 // TODO: this wont work right now, need release 919000 first
162 // await helper.methods.setOffchainSchema(collectionIdAddress, 'https://offchain-service.local/token-info/{id}').send();162 // await helper.methods.setOffchainSchema(collectionIdAddress, 'https://offchain-service.local/token-info/{id}').send();
163 // const tokenUri = await contract.methods.tokenURI(nextTokenId).call();163 // const tokenUri = await contract.methods.tokenURI(nextTokenId).call();