git.delta.rocks / unique-network / refs/commits / 6b456b94d3ef

difftreelog

feat submit chain extension produced logs

Yaroslav Bolyukin2021-05-07parent: #3e52698.patch.diff
in: master

1 file changed

modifiedruntime/src/chain_extension.rsdiffbeforeafterboth
9292
93 let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;93 let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;
9494
95 match pallet_nft::Module::<C>::transfer_internal(95 pallet_nft::Module::<C>::transfer_internal(
96 &C::CrossAccountId::from_sub(env.ext().caller().clone()),96 &C::CrossAccountId::from_sub(env.ext().caller().clone()),
97 &C::CrossAccountId::from_sub(input.recipient),97 &C::CrossAccountId::from_sub(input.recipient),
98 &collection,98 &collection,
99 input.token_id,99 input.token_id,
100 input.amount,100 input.amount,
101 ) {101 )?;
102
102 Ok(_) => Ok(RetVal::Converging(func_id)),103 pallet_nft::Module::<C>::submit_logs(collection)?;
103 _ => Err(DispatchError::Other("Transfer error"))104 Ok(RetVal::Converging(func_id))
104 }
105 },105 },
106 1 => {106 1 => {
107 // Create Item107 // Create Item
110110
111 let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;111 let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;
112112
113 match pallet_nft::Module::<C>::create_item_internal(113 pallet_nft::Module::<C>::create_item_internal(
114 &C::CrossAccountId::from_sub(env.ext().address().clone()),114 &C::CrossAccountId::from_sub(env.ext().address().clone()),
115 &collection,115 &collection,
116 &C::CrossAccountId::from_sub(input.owner),116 &C::CrossAccountId::from_sub(input.owner),
117 input.data,117 input.data,
118 ) {118 )?;
119
119 Ok(_) => Ok(RetVal::Converging(func_id)),120 pallet_nft::Module::<C>::submit_logs(collection)?;
120 _ => Err(DispatchError::Other("CreateItem error"))121 Ok(RetVal::Converging(func_id))
121 }
122 },122 },
123 2 => {123 2 => {
124 // Create multiple items124 // Create multiple items
127127
128 let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;128 let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;
129129
130 match pallet_nft::Module::<C>::create_multiple_items_internal(130 pallet_nft::Module::<C>::create_multiple_items_internal(
131 &C::CrossAccountId::from_sub(env.ext().address().clone()),131 &C::CrossAccountId::from_sub(env.ext().address().clone()),
132 &collection,132 &collection,
133 &C::CrossAccountId::from_sub(input.owner),133 &C::CrossAccountId::from_sub(input.owner),
134 input.data,134 input.data,
135 ) {135 )?;
136
136 Ok(_) => Ok(RetVal::Converging(func_id)),137 pallet_nft::Module::<C>::submit_logs(collection)?;
137 _ => Err(DispatchError::Other("CreateMultipleItems error"))138 Ok(RetVal::Converging(func_id))
138 }
139 },139 },
140 3 => {140 3 => {
141 // Approve141 // Approve
152 input.amount,152 input.amount,
153 )?;153 )?;
154
155 pallet_nft::Module::<C>::submit_logs(collection)?;
154 Ok(RetVal::Converging(func_id))156 Ok(RetVal::Converging(func_id))
155 },157 },
156 4 => {158 4 => {
169 input.amount171 input.amount
170 )?;172 )?;
173
174 pallet_nft::Module::<C>::submit_logs(collection)?;
171 Ok(RetVal::Converging(func_id))175 Ok(RetVal::Converging(func_id))
172 },176 },
173 5 => {177 5 => {
184 input.data,188 input.data,
185 )?;189 )?;
190
191 pallet_nft::Module::<C>::submit_logs(collection)?;
186 Ok(RetVal::Converging(func_id))192 Ok(RetVal::Converging(func_id))
187 },193 },
188 6 => {194 6 => {
199 input.whitelisted,205 input.whitelisted,
200 )?;206 )?;
207
208 pallet_nft::Module::<C>::submit_logs(collection)?;
201 Ok(RetVal::Converging(func_id))209 Ok(RetVal::Converging(func_id))
202 }210 }
203 _ => {211 _ => {