git.delta.rocks / unique-network / refs/commits / 0c40eab5740e

difftreelog

change error type for `ensure_single_owner`

PraetorP2022-12-06parent: #242bfed.patch.diff
in: master

2 files changed

modifiedpallets/refungible/src/erc.rsdiffbeforeafterboth
512512
513 if owner_balance == 0 {513 if owner_balance == 0 {
514 return Err(dispatch_to_evm::<T>(514 return Err(dispatch_to_evm::<T>(
515 <CommonError<T>>::TokenValueTooLow.into(),515 <CommonError<T>>::MustBeTokenOwner.into(),
516 ));516 ));
517 }517 }
518518
modifiedruntime/tests/src/tests.rsdiffbeforeafterboth
625 });625 });
626}626}
627
628#[test]
629fn transfer_nft_item_zero_value() {
630 new_test_ext().execute_with(|| {
631 let collection_id = create_test_collection(&CollectionMode::NFT, CollectionId(1));
632
633 let data = default_nft_data();
634 create_test_item(collection_id, &data.into());
635 assert_eq!(
636 <pallet_nonfungible::AccountBalance<Test>>::get((collection_id, account(1))),
637 1
638 );
639 assert_eq!(
640 <pallet_nonfungible::Owned<Test>>::get((collection_id, account(1), TokenId(1))),
641 true
642 );
643
644 let origin1 = RuntimeOrigin::signed(1);
645
646 // Transferring 0 amount works on NFT...
647 assert_ok!(Unique::transfer(
648 origin1,
649 account(2),
650 CollectionId(1),
651 TokenId(1),
652 0
653 ));
654 // ... and results in no transfer
655 assert_eq!(
656 <pallet_nonfungible::AccountBalance<Test>>::get((collection_id, account(1))),
657 1
658 );
659 assert_eq!(
660 <pallet_nonfungible::Owned<Test>>::get((collection_id, account(1), TokenId(1))),
661 true
662 );
663 });
664}
665627
666#[test]628#[test]
667fn nft_approve_and_transfer_from() {629fn nft_approve_and_transfer_from() {