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

difftreelog

feat change `collection_properties` return type to named struct

Grigoriy Simonov2022-11-23parent: #93efc9e.patch.diff
in: master

16 files changed

modifiedpallets/common/src/erc.rsdiffbeforeafterboth
178 ///178 ///
179 /// @param keys Properties keys. Empty keys for all propertyes.179 /// @param keys Properties keys. Empty keys for all propertyes.
180 /// @return Vector of properties key/value pairs.180 /// @return Vector of properties key/value pairs.
181 fn collection_properties(&self, keys: Vec<string>) -> Result<Vec<(string, bytes)>> {181 fn collection_properties(&self, keys: Vec<string>) -> Result<Vec<PropertyStruct>> {
182 let keys = keys182 let keys = keys
183 .into_iter()183 .into_iter()
184 .map(|key| {184 .map(|key| {
200 let key =200 let key =
201 string::from_utf8(p.key.into()).map_err(|e| Error::Revert(format!("{}", e)))?;201 string::from_utf8(p.key.into()).map_err(|e| Error::Revert(format!("{}", e)))?;
202 let value = bytes(p.value.to_vec());202 let value = bytes(p.value.to_vec());
203 Ok((key, value))203 Ok(PropertyStruct { key, value })
204 })204 })
205 .collect::<Result<Vec<_>>>()?;205 .collect::<Result<Vec<_>>>()?;
206 Ok(properties)206 Ok(properties)
modifiedpallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth
87 /// @return Vector of properties key/value pairs.87 /// @return Vector of properties key/value pairs.
88 /// @dev EVM selector for this function is: 0x285fb8e6,88 /// @dev EVM selector for this function is: 0x285fb8e6,
89 /// or in textual repr: collectionProperties(string[])89 /// or in textual repr: collectionProperties(string[])
90 function collectionProperties(string[] memory keys) public view returns (Tuple16[] memory) {90 function collectionProperties(string[] memory keys) public view returns (Property[] memory) {
91 require(false, stub_error);91 require(false, stub_error);
92 keys;92 keys;
93 dummy;93 dummy;
94 return new Tuple16[](0);94 return new Property[](0);
95 }95 }
9696
97 // /// Set the sponsor of the collection.97 // /// Set the sponsor of the collection.
425 uint256 sub;425 uint256 sub;
426}426}
427
428/// @dev anonymous struct
429struct Tuple16 {
430 string field_0;
431 bytes field_1;
432}
433427
434/// @dev Property struct428/// @dev Property struct
435struct Property {429struct Property {
modifiedpallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth
188 /// @return Vector of properties key/value pairs.188 /// @return Vector of properties key/value pairs.
189 /// @dev EVM selector for this function is: 0x285fb8e6,189 /// @dev EVM selector for this function is: 0x285fb8e6,
190 /// or in textual repr: collectionProperties(string[])190 /// or in textual repr: collectionProperties(string[])
191 function collectionProperties(string[] memory keys) public view returns (Tuple27[] memory) {191 function collectionProperties(string[] memory keys) public view returns (Property[] memory) {
192 require(false, stub_error);192 require(false, stub_error);
193 keys;193 keys;
194 dummy;194 dummy;
195 return new Tuple27[](0);195 return new Property[](0);
196 }196 }
197197
198 // /// Set the sponsor of the collection.198 // /// Set the sponsor of the collection.
532 uint256 field_1;532 uint256 field_1;
533}533}
534
535/// @dev anonymous struct
536struct Tuple27 {
537 string field_0;
538 bytes field_1;
539}
540534
541/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension535/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension
542/// @dev See https://eips.ethereum.org/EIPS/eip-721536/// @dev See https://eips.ethereum.org/EIPS/eip-721
modifiedpallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth
188 /// @return Vector of properties key/value pairs.188 /// @return Vector of properties key/value pairs.
189 /// @dev EVM selector for this function is: 0x285fb8e6,189 /// @dev EVM selector for this function is: 0x285fb8e6,
190 /// or in textual repr: collectionProperties(string[])190 /// or in textual repr: collectionProperties(string[])
191 function collectionProperties(string[] memory keys) public view returns (Tuple26[] memory) {191 function collectionProperties(string[] memory keys) public view returns (Property[] memory) {
192 require(false, stub_error);192 require(false, stub_error);
193 keys;193 keys;
194 dummy;194 dummy;
195 return new Tuple26[](0);195 return new Property[](0);
196 }196 }
197197
198 // /// Set the sponsor of the collection.198 // /// Set the sponsor of the collection.
532 uint256 field_1;532 uint256 field_1;
533}533}
534
535/// @dev anonymous struct
536struct Tuple26 {
537 string field_0;
538 bytes field_1;
539}
540534
541/// @dev the ERC-165 identifier for this interface is 0x5b5e139f535/// @dev the ERC-165 identifier for this interface is 0x5b5e139f
542contract ERC721Metadata is Dummy, ERC165 {536contract ERC721Metadata is Dummy, ERC165 {
modifiedpallets/refungible/src/stubs/UniqueRefungibleToken.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/unique/src/eth/stubs/CollectionHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedtests/src/eth/abi/fungible.jsondiffbeforeafterboth
216 "outputs": [216 "outputs": [
217 {217 {
218 "components": [218 "components": [
219 { "internalType": "string", "name": "field_0", "type": "string" },219 { "internalType": "string", "name": "key", "type": "string" },
220 { "internalType": "bytes", "name": "field_1", "type": "bytes" }220 { "internalType": "bytes", "name": "value", "type": "bytes" }
221 ],221 ],
222 "internalType": "struct Tuple16[]",222 "internalType": "struct Property[]",
223 "name": "",223 "name": "",
224 "type": "tuple[]"224 "type": "tuple[]"
225 }225 }
modifiedtests/src/eth/abi/nonFungible.jsondiffbeforeafterboth
246 "outputs": [246 "outputs": [
247 {247 {
248 "components": [248 "components": [
249 { "internalType": "string", "name": "field_0", "type": "string" },249 { "internalType": "string", "name": "key", "type": "string" },
250 { "internalType": "bytes", "name": "field_1", "type": "bytes" }250 { "internalType": "bytes", "name": "value", "type": "bytes" }
251 ],251 ],
252 "internalType": "struct Tuple27[]",252 "internalType": "struct Property[]",
253 "name": "",253 "name": "",
254 "type": "tuple[]"254 "type": "tuple[]"
255 }255 }
modifiedtests/src/eth/abi/reFungible.jsondiffbeforeafterboth
228 "outputs": [228 "outputs": [
229 {229 {
230 "components": [230 "components": [
231 { "internalType": "string", "name": "field_0", "type": "string" },231 { "internalType": "string", "name": "key", "type": "string" },
232 { "internalType": "bytes", "name": "field_1", "type": "bytes" }232 { "internalType": "bytes", "name": "value", "type": "bytes" }
233 ],233 ],
234 "internalType": "struct Tuple26[]",234 "internalType": "struct Property[]",
235 "name": "",235 "name": "",
236 "type": "tuple[]"236 "type": "tuple[]"
237 }237 }
modifiedtests/src/eth/api/UniqueFungible.soldiffbeforeafterboth
60 /// @return Vector of properties key/value pairs.60 /// @return Vector of properties key/value pairs.
61 /// @dev EVM selector for this function is: 0x285fb8e6,61 /// @dev EVM selector for this function is: 0x285fb8e6,
62 /// or in textual repr: collectionProperties(string[])62 /// or in textual repr: collectionProperties(string[])
63 function collectionProperties(string[] memory keys) external view returns (Tuple16[] memory);63 function collectionProperties(string[] memory keys) external view returns (Property[] memory);
6464
65 // /// Set the sponsor of the collection.65 // /// Set the sponsor of the collection.
66 // ///66 // ///
278 uint256 sub;278 uint256 sub;
279}279}
280
281/// @dev anonymous struct
282struct Tuple16 {
283 string field_0;
284 bytes field_1;
285}
286280
287/// @dev Property struct281/// @dev Property struct
288struct Property {282struct Property {
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
127 /// @return Vector of properties key/value pairs.127 /// @return Vector of properties key/value pairs.
128 /// @dev EVM selector for this function is: 0x285fb8e6,128 /// @dev EVM selector for this function is: 0x285fb8e6,
129 /// or in textual repr: collectionProperties(string[])129 /// or in textual repr: collectionProperties(string[])
130 function collectionProperties(string[] memory keys) external view returns (Tuple25[] memory);130 function collectionProperties(string[] memory keys) external view returns (Property[] memory);
131131
132 // /// Set the sponsor of the collection.132 // /// Set the sponsor of the collection.
133 // ///133 // ///
169 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.169 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
170 /// @dev EVM selector for this function is: 0x6ec0a9f1,170 /// @dev EVM selector for this function is: 0x6ec0a9f1,
171 /// or in textual repr: collectionSponsor()171 /// or in textual repr: collectionSponsor()
172 function collectionSponsor() external view returns (Tuple28 memory);172 function collectionSponsor() external view returns (Tuple27 memory);
173173
174 /// Set limits for the collection.174 /// Set limits for the collection.
175 /// @dev Throws error if limit not found.175 /// @dev Throws error if limit not found.
346}346}
347347
348/// @dev anonymous struct348/// @dev anonymous struct
349struct Tuple28 {349struct Tuple27 {
350 address field_0;350 address field_0;
351 uint256 field_1;351 uint256 field_1;
352}352}
353
354/// @dev anonymous struct
355struct Tuple25 {
356 string field_0;
357 bytes field_1;
358}
359353
360/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension354/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension
361/// @dev See https://eips.ethereum.org/EIPS/eip-721355/// @dev See https://eips.ethereum.org/EIPS/eip-721
modifiedtests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth
127 /// @return Vector of properties key/value pairs.127 /// @return Vector of properties key/value pairs.
128 /// @dev EVM selector for this function is: 0x285fb8e6,128 /// @dev EVM selector for this function is: 0x285fb8e6,
129 /// or in textual repr: collectionProperties(string[])129 /// or in textual repr: collectionProperties(string[])
130 function collectionProperties(string[] memory keys) external view returns (Tuple24[] memory);130 function collectionProperties(string[] memory keys) external view returns (Property[] memory);
131131
132 // /// Set the sponsor of the collection.132 // /// Set the sponsor of the collection.
133 // ///133 // ///
169 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.169 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
170 /// @dev EVM selector for this function is: 0x6ec0a9f1,170 /// @dev EVM selector for this function is: 0x6ec0a9f1,
171 /// or in textual repr: collectionSponsor()171 /// or in textual repr: collectionSponsor()
172 function collectionSponsor() external view returns (Tuple27 memory);172 function collectionSponsor() external view returns (Tuple26 memory);
173173
174 /// Set limits for the collection.174 /// Set limits for the collection.
175 /// @dev Throws error if limit not found.175 /// @dev Throws error if limit not found.
346}346}
347347
348/// @dev anonymous struct348/// @dev anonymous struct
349struct Tuple27 {349struct Tuple26 {
350 address field_0;350 address field_0;
351 uint256 field_1;351 uint256 field_1;
352}352}
353
354/// @dev anonymous struct
355struct Tuple24 {
356 string field_0;
357 bytes field_1;
358}
359353
360/// @dev the ERC-165 identifier for this interface is 0x5b5e139f354/// @dev the ERC-165 identifier for this interface is 0x5b5e139f
361interface ERC721Metadata is Dummy, ERC165 {355interface ERC721Metadata is Dummy, ERC165 {