@@ -1721,3 +1721,100 @@ fn send_with_insufficient_weight_limit() {
17211721 assert_eq ! ( ParaTokens :: free_balance( CurrencyId :: A , & BOB ) , 0 ) ;
17221722 } ) ;
17231723}
1724+
1725+ #[ test]
1726+ fn send_multiasset_with_zero_fee_should_yield_an_error ( ) {
1727+ TestNet :: reset ( ) ;
1728+
1729+ let asset_id: AssetId = X1 ( Junction :: from ( BoundedVec :: try_from ( b"A" . to_vec ( ) ) . unwrap ( ) ) ) . into ( ) ;
1730+ ParaA :: execute_with ( || {
1731+ assert_noop ! (
1732+ ParaXTokens :: transfer_multiasset_with_fee(
1733+ Some ( ALICE ) . into( ) ,
1734+ Box :: new( ( asset_id, 100 ) . into( ) ) ,
1735+ Box :: new( ( asset_id, Fungibility :: Fungible ( 0 ) ) . into( ) ) ,
1736+ Box :: new(
1737+ MultiLocation :: new(
1738+ 1 ,
1739+ X2 (
1740+ Parachain ( 2 ) ,
1741+ Junction :: AccountId32 {
1742+ network: None ,
1743+ id: BOB . into( )
1744+ } ,
1745+ )
1746+ )
1747+ . into( )
1748+ ) ,
1749+ WeightLimit :: Unlimited ,
1750+ ) ,
1751+ Error :: <para:: Runtime >:: InvalidAsset
1752+ ) ;
1753+ } ) ;
1754+ }
1755+
1756+ #[ test]
1757+ fn send_undefined_nft_should_yield_an_error ( ) {
1758+ TestNet :: reset ( ) ;
1759+
1760+ let fee_id: AssetId = X1 ( Junction :: from ( BoundedVec :: try_from ( b"A" . to_vec ( ) ) . unwrap ( ) ) ) . into ( ) ;
1761+ let nft_id: AssetId = X1 ( Junction :: GeneralIndex ( 42 ) ) . into ( ) ;
1762+
1763+ ParaA :: execute_with ( || {
1764+ assert_noop ! (
1765+ ParaXTokens :: transfer_multiasset_with_fee(
1766+ Some ( ALICE ) . into( ) ,
1767+ Box :: new( ( nft_id, Undefined ) . into( ) ) ,
1768+ Box :: new( ( fee_id, 100 ) . into( ) ) ,
1769+ Box :: new(
1770+ MultiLocation :: new(
1771+ 1 ,
1772+ X2 (
1773+ Parachain ( 2 ) ,
1774+ Junction :: AccountId32 {
1775+ network: None ,
1776+ id: BOB . into( )
1777+ } ,
1778+ )
1779+ )
1780+ . into( )
1781+ ) ,
1782+ WeightLimit :: Unlimited ,
1783+ ) ,
1784+ Error :: <para:: Runtime >:: InvalidAsset
1785+ ) ;
1786+ } ) ;
1787+ }
1788+
1789+ #[ test]
1790+ fn nfts_cannot_be_fee_assets ( ) {
1791+ TestNet :: reset ( ) ;
1792+
1793+ let asset_id: AssetId = X1 ( Junction :: from ( BoundedVec :: try_from ( b"A" . to_vec ( ) ) . unwrap ( ) ) ) . into ( ) ;
1794+ let nft_id: AssetId = X1 ( Junction :: GeneralIndex ( 42 ) ) . into ( ) ;
1795+
1796+ ParaA :: execute_with ( || {
1797+ assert_noop ! (
1798+ ParaXTokens :: transfer_multiasset_with_fee(
1799+ Some ( ALICE ) . into( ) ,
1800+ Box :: new( ( asset_id, 100 ) . into( ) ) ,
1801+ Box :: new( ( nft_id, Index ( 1 ) ) . into( ) ) ,
1802+ Box :: new(
1803+ MultiLocation :: new(
1804+ 1 ,
1805+ X2 (
1806+ Parachain ( 2 ) ,
1807+ Junction :: AccountId32 {
1808+ network: None ,
1809+ id: BOB . into( )
1810+ } ,
1811+ )
1812+ )
1813+ . into( )
1814+ ) ,
1815+ WeightLimit :: Unlimited ,
1816+ ) ,
1817+ Error :: <para:: Runtime >:: InvalidAsset
1818+ ) ;
1819+ } ) ;
1820+ }
0 commit comments