difftreelog
add `collectionHelperAddress` method to `ERC721` & `ERC20` interfaces.
in: master
14 files changed
pallets/fungible/src/erc.rsdiffbeforeafterboth--- a/pallets/fungible/src/erc.rs
+++ b/pallets/fungible/src/erc.rs
@@ -30,6 +30,7 @@
use pallet_evm_coder_substrate::{call, dispatch_to_evm};
use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};
use pallet_common::{CollectionHandle, erc::CollectionCall};
+use sp_core::Get;
use crate::{
Allowance, Balance, Config, FungibleHandle, Pallet, SelfWeightOf, TotalSupply,
@@ -132,6 +133,11 @@
Ok(<Allowance<T>>::get((self.id, owner, spender)).into())
}
+
+ /// @notice Returns collection helper contract address
+ fn collection_helper_address(&self) -> Result<address> {
+ Ok(T::ContractAddress::get())
+ }
}
#[solidity_interface(name = ERC20Mintable)]
pallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth1// SPDX-License-Identifier: OTHER2// This code is automatically generated34pragma solidity >=0.8.0 <0.9.0;56/// @dev common stubs holder7contract Dummy {8 uint8 dummy;9 string stub_error = "this contract is implemented in native";10}1112contract ERC165 is Dummy {13 function supportsInterface(bytes4 interfaceID) external view returns (bool) {14 require(false, stub_error);15 interfaceID;16 return true;17 }18}1920/// @title A contract that allows you to work with collections.21/// @dev the ERC-165 identifier for this interface is 0xcc1d80ca22contract Collection is Dummy, ERC165 {23 // /// Set collection property.24 // ///25 // /// @param key Property key.26 // /// @param value Propery value.27 // /// @dev EVM selector for this function is: 0x2f073f66,28 // /// or in textual repr: setCollectionProperty(string,bytes)29 // function setCollectionProperty(string memory key, bytes memory value) public {30 // require(false, stub_error);31 // key;32 // value;33 // dummy = 0;34 // }3536 /// Set collection properties.37 ///38 /// @param properties Vector of properties key/value pair.39 /// @dev EVM selector for this function is: 0x50b26b2a,40 /// or in textual repr: setCollectionProperties((string,bytes)[])41 function setCollectionProperties(Property[] memory properties) public {42 require(false, stub_error);43 properties;44 dummy = 0;45 }4647 // /// Delete collection property.48 // ///49 // /// @param key Property key.50 // /// @dev EVM selector for this function is: 0x7b7debce,51 // /// or in textual repr: deleteCollectionProperty(string)52 // function deleteCollectionProperty(string memory key) public {53 // require(false, stub_error);54 // key;55 // dummy = 0;56 // }5758 /// Delete collection properties.59 ///60 /// @param keys Properties keys.61 /// @dev EVM selector for this function is: 0xee206ee3,62 /// or in textual repr: deleteCollectionProperties(string[])63 function deleteCollectionProperties(string[] memory keys) public {64 require(false, stub_error);65 keys;66 dummy = 0;67 }6869 /// Get collection property.70 ///71 /// @dev Throws error if key not found.72 ///73 /// @param key Property key.74 /// @return bytes The property corresponding to the key.75 /// @dev EVM selector for this function is: 0xcf24fd6d,76 /// or in textual repr: collectionProperty(string)77 function collectionProperty(string memory key) public view returns (bytes memory) {78 require(false, stub_error);79 key;80 dummy;81 return hex"";82 }8384 /// Get collection properties.85 ///86 /// @param keys Properties keys. Empty keys for all propertyes.87 /// @return Vector of properties key/value pairs.88 /// @dev EVM selector for this function is: 0x285fb8e6,89 /// or in textual repr: collectionProperties(string[])90 function collectionProperties(string[] memory keys) public view returns (Property[] memory) {91 require(false, stub_error);92 keys;93 dummy;94 return new Property[](0);95 }9697 // /// Set the sponsor of the collection.98 // ///99 // /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.100 // ///101 // /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.102 // /// @dev EVM selector for this function is: 0x7623402e,103 // /// or in textual repr: setCollectionSponsor(address)104 // function setCollectionSponsor(address sponsor) public {105 // require(false, stub_error);106 // sponsor;107 // dummy = 0;108 // }109110 /// Set the sponsor of the collection.111 ///112 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.113 ///114 /// @param sponsor Cross account address of the sponsor from whose account funds will be debited for operations with the contract.115 /// @dev EVM selector for this function is: 0x84a1d5a8,116 /// or in textual repr: setCollectionSponsorCross((address,uint256))117 function setCollectionSponsorCross(EthCrossAccount memory sponsor) public {118 require(false, stub_error);119 sponsor;120 dummy = 0;121 }122123 /// Whether there is a pending sponsor.124 /// @dev EVM selector for this function is: 0x058ac185,125 /// or in textual repr: hasCollectionPendingSponsor()126 function hasCollectionPendingSponsor() public view returns (bool) {127 require(false, stub_error);128 dummy;129 return false;130 }131132 /// Collection sponsorship confirmation.133 ///134 /// @dev After setting the sponsor for the collection, it must be confirmed with this function.135 /// @dev EVM selector for this function is: 0x3c50e97a,136 /// or in textual repr: confirmCollectionSponsorship()137 function confirmCollectionSponsorship() public {138 require(false, stub_error);139 dummy = 0;140 }141142 /// Remove collection sponsor.143 /// @dev EVM selector for this function is: 0x6e0326a3,144 /// or in textual repr: removeCollectionSponsor()145 function removeCollectionSponsor() public {146 require(false, stub_error);147 dummy = 0;148 }149150 /// Get current sponsor.151 ///152 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.153 /// @dev EVM selector for this function is: 0x6ec0a9f1,154 /// or in textual repr: collectionSponsor()155 function collectionSponsor() public view returns (Tuple8 memory) {156 require(false, stub_error);157 dummy;158 return Tuple8(0x0000000000000000000000000000000000000000, 0);159 }160161 /// Set limits for the collection.162 /// @dev Throws error if limit not found.163 /// @param limit Name of the limit. Valid names:164 /// "accountTokenOwnershipLimit",165 /// "sponsoredDataSize",166 /// "sponsoredDataRateLimit",167 /// "tokenLimit",168 /// "sponsorTransferTimeout",169 /// "sponsorApproveTimeout"170 /// "ownerCanTransfer",171 /// "ownerCanDestroy",172 /// "transfersEnabled"173 /// @param value Value of the limit.174 /// @dev EVM selector for this function is: 0x4ad890a8,175 /// or in textual repr: setCollectionLimit(string,uint256)176 function setCollectionLimit(string memory limit, uint256 value) public {177 require(false, stub_error);178 limit;179 value;180 dummy = 0;181 }182183 /// Get contract address.184 /// @dev EVM selector for this function is: 0xf6b4dfb4,185 /// or in textual repr: contractAddress()186 function contractAddress() public view returns (address) {187 require(false, stub_error);188 dummy;189 return 0x0000000000000000000000000000000000000000;190 }191192 /// Add collection admin.193 /// @param newAdmin Cross account administrator address.194 /// @dev EVM selector for this function is: 0x859aa7d6,195 /// or in textual repr: addCollectionAdminCross((address,uint256))196 function addCollectionAdminCross(EthCrossAccount memory newAdmin) public {197 require(false, stub_error);198 newAdmin;199 dummy = 0;200 }201202 /// Remove collection admin.203 /// @param admin Cross account administrator address.204 /// @dev EVM selector for this function is: 0x6c0cd173,205 /// or in textual repr: removeCollectionAdminCross((address,uint256))206 function removeCollectionAdminCross(EthCrossAccount memory admin) public {207 require(false, stub_error);208 admin;209 dummy = 0;210 }211212 // /// Add collection admin.213 // /// @param newAdmin Address of the added administrator.214 // /// @dev EVM selector for this function is: 0x92e462c7,215 // /// or in textual repr: addCollectionAdmin(address)216 // function addCollectionAdmin(address newAdmin) public {217 // require(false, stub_error);218 // newAdmin;219 // dummy = 0;220 // }221222 // /// Remove collection admin.223 // ///224 // /// @param admin Address of the removed administrator.225 // /// @dev EVM selector for this function is: 0xfafd7b42,226 // /// or in textual repr: removeCollectionAdmin(address)227 // function removeCollectionAdmin(address admin) public {228 // require(false, stub_error);229 // admin;230 // dummy = 0;231 // }232233 /// Toggle accessibility of collection nesting.234 ///235 /// @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'236 /// @dev EVM selector for this function is: 0x112d4586,237 /// or in textual repr: setCollectionNesting(bool)238 function setCollectionNesting(bool enable) public {239 require(false, stub_error);240 enable;241 dummy = 0;242 }243244 /// Toggle accessibility of collection nesting.245 ///246 /// @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'247 /// @param collections Addresses of collections that will be available for nesting.248 /// @dev EVM selector for this function is: 0x64872396,249 /// or in textual repr: setCollectionNesting(bool,address[])250 function setCollectionNesting(bool enable, address[] memory collections) public {251 require(false, stub_error);252 enable;253 collections;254 dummy = 0;255 }256257 /// Set the collection access method.258 /// @param mode Access mode259 /// 0 for Normal260 /// 1 for AllowList261 /// @dev EVM selector for this function is: 0x41835d4c,262 /// or in textual repr: setCollectionAccess(uint8)263 function setCollectionAccess(uint8 mode) public {264 require(false, stub_error);265 mode;266 dummy = 0;267 }268269 /// Checks that user allowed to operate with collection.270 ///271 /// @param user User address to check.272 /// @dev EVM selector for this function is: 0x91b6df49,273 /// or in textual repr: allowlistedCross((address,uint256))274 function allowlistedCross(EthCrossAccount memory user) public view returns (bool) {275 require(false, stub_error);276 user;277 dummy;278 return false;279 }280281 // /// Add the user to the allowed list.282 // ///283 // /// @param user Address of a trusted user.284 // /// @dev EVM selector for this function is: 0x67844fe6,285 // /// or in textual repr: addToCollectionAllowList(address)286 // function addToCollectionAllowList(address user) public {287 // require(false, stub_error);288 // user;289 // dummy = 0;290 // }291292 /// Add user to allowed list.293 ///294 /// @param user User cross account address.295 /// @dev EVM selector for this function is: 0xa0184a3a,296 /// or in textual repr: addToCollectionAllowListCross((address,uint256))297 function addToCollectionAllowListCross(EthCrossAccount memory user) public {298 require(false, stub_error);299 user;300 dummy = 0;301 }302303 // /// Remove the user from the allowed list.304 // ///305 // /// @param user Address of a removed user.306 // /// @dev EVM selector for this function is: 0x85c51acb,307 // /// or in textual repr: removeFromCollectionAllowList(address)308 // function removeFromCollectionAllowList(address user) public {309 // require(false, stub_error);310 // user;311 // dummy = 0;312 // }313314 /// Remove user from allowed list.315 ///316 /// @param user User cross account address.317 /// @dev EVM selector for this function is: 0x09ba452a,318 /// or in textual repr: removeFromCollectionAllowListCross((address,uint256))319 function removeFromCollectionAllowListCross(EthCrossAccount memory user) public {320 require(false, stub_error);321 user;322 dummy = 0;323 }324325 /// Switch permission for minting.326 ///327 /// @param mode Enable if "true".328 /// @dev EVM selector for this function is: 0x00018e84,329 /// or in textual repr: setCollectionMintMode(bool)330 function setCollectionMintMode(bool mode) public {331 require(false, stub_error);332 mode;333 dummy = 0;334 }335336 // /// Check that account is the owner or admin of the collection337 // ///338 // /// @param user account to verify339 // /// @return "true" if account is the owner or admin340 // /// @dev EVM selector for this function is: 0x9811b0c7,341 // /// or in textual repr: isOwnerOrAdmin(address)342 // function isOwnerOrAdmin(address user) public view returns (bool) {343 // require(false, stub_error);344 // user;345 // dummy;346 // return false;347 // }348349 /// Check that account is the owner or admin of the collection350 ///351 /// @param user User cross account to verify352 /// @return "true" if account is the owner or admin353 /// @dev EVM selector for this function is: 0x3e75a905,354 /// or in textual repr: isOwnerOrAdminCross((address,uint256))355 function isOwnerOrAdminCross(EthCrossAccount memory user) public view returns (bool) {356 require(false, stub_error);357 user;358 dummy;359 return false;360 }361362 /// Returns collection type363 ///364 /// @return `Fungible` or `NFT` or `ReFungible`365 /// @dev EVM selector for this function is: 0xd34b55b8,366 /// or in textual repr: uniqueCollectionType()367 function uniqueCollectionType() public view returns (string memory) {368 require(false, stub_error);369 dummy;370 return "";371 }372373 /// Get collection owner.374 ///375 /// @return Tuble with sponsor address and his substrate mirror.376 /// If address is canonical then substrate mirror is zero and vice versa.377 /// @dev EVM selector for this function is: 0xdf727d3b,378 /// or in textual repr: collectionOwner()379 function collectionOwner() public view returns (EthCrossAccount memory) {380 require(false, stub_error);381 dummy;382 return EthCrossAccount(0x0000000000000000000000000000000000000000, 0);383 }384385 // /// Changes collection owner to another account386 // ///387 // /// @dev Owner can be changed only by current owner388 // /// @param newOwner new owner account389 // /// @dev EVM selector for this function is: 0x4f53e226,390 // /// or in textual repr: changeCollectionOwner(address)391 // function changeCollectionOwner(address newOwner) public {392 // require(false, stub_error);393 // newOwner;394 // dummy = 0;395 // }396397 /// Get collection administrators398 ///399 /// @return Vector of tuples with admins address and his substrate mirror.400 /// If address is canonical then substrate mirror is zero and vice versa.401 /// @dev EVM selector for this function is: 0x5813216b,402 /// or in textual repr: collectionAdmins()403 function collectionAdmins() public view returns (EthCrossAccount[] memory) {404 require(false, stub_error);405 dummy;406 return new EthCrossAccount[](0);407 }408409 /// Changes collection owner to another account410 ///411 /// @dev Owner can be changed only by current owner412 /// @param newOwner new owner cross account413 /// @dev EVM selector for this function is: 0x6496c497,414 /// or in textual repr: changeCollectionOwnerCross((address,uint256))415 function changeCollectionOwnerCross(EthCrossAccount memory newOwner) public {416 require(false, stub_error);417 newOwner;418 dummy = 0;419 }420}421422/// @dev Cross account struct423struct EthCrossAccount {424 address eth;425 uint256 sub;426}427428/// @dev Property struct429struct Property {430 string key;431 bytes value;432}433434/// @dev the ERC-165 identifier for this interface is 0x5b7038cf435contract ERC20UniqueExtensions is Dummy, ERC165 {436 /// @notice A description for the collection.437 /// @dev EVM selector for this function is: 0x7284e416,438 /// or in textual repr: description()439 function description() public view returns (string memory) {440 require(false, stub_error);441 dummy;442 return "";443 }444445 /// @dev EVM selector for this function is: 0x0ecd0ab0,446 /// or in textual repr: approveCross((address,uint256),uint256)447 function approveCross(EthCrossAccount memory spender, uint256 amount) public returns (bool) {448 require(false, stub_error);449 spender;450 amount;451 dummy = 0;452 return false;453 }454455 // /// Burn tokens from account456 // /// @dev Function that burns an `amount` of the tokens of a given account,457 // /// deducting from the sender's allowance for said account.458 // /// @param from The account whose tokens will be burnt.459 // /// @param amount The amount that will be burnt.460 // /// @dev EVM selector for this function is: 0x79cc6790,461 // /// or in textual repr: burnFrom(address,uint256)462 // function burnFrom(address from, uint256 amount) public returns (bool) {463 // require(false, stub_error);464 // from;465 // amount;466 // dummy = 0;467 // return false;468 // }469470 /// Burn tokens from account471 /// @dev Function that burns an `amount` of the tokens of a given account,472 /// deducting from the sender's allowance for said account.473 /// @param from The account whose tokens will be burnt.474 /// @param amount The amount that will be burnt.475 /// @dev EVM selector for this function is: 0xbb2f5a58,476 /// or in textual repr: burnFromCross((address,uint256),uint256)477 function burnFromCross(EthCrossAccount memory from, uint256 amount) public returns (bool) {478 require(false, stub_error);479 from;480 amount;481 dummy = 0;482 return false;483 }484485 /// Mint tokens for multiple accounts.486 /// @param amounts array of pairs of account address and amount487 /// @dev EVM selector for this function is: 0x1acf2d55,488 /// or in textual repr: mintBulk((address,uint256)[])489 function mintBulk(Tuple8[] memory amounts) public returns (bool) {490 require(false, stub_error);491 amounts;492 dummy = 0;493 return false;494 }495496 /// @dev EVM selector for this function is: 0x2ada85ff,497 /// or in textual repr: transferCross((address,uint256),uint256)498 function transferCross(EthCrossAccount memory to, uint256 amount) public returns (bool) {499 require(false, stub_error);500 to;501 amount;502 dummy = 0;503 return false;504 }505506 /// @dev EVM selector for this function is: 0xd5cf430b,507 /// or in textual repr: transferFromCross((address,uint256),(address,uint256),uint256)508 function transferFromCross(509 EthCrossAccount memory from,510 EthCrossAccount memory to,511 uint256 amount512 ) public returns (bool) {513 require(false, stub_error);514 from;515 to;516 amount;517 dummy = 0;518 return false;519 }520}521522/// @dev anonymous struct523struct Tuple8 {524 address field_0;525 uint256 field_1;526}527528/// @dev the ERC-165 identifier for this interface is 0x40c10f19529contract ERC20Mintable is Dummy, ERC165 {530 /// Mint tokens for `to` account.531 /// @param to account that will receive minted tokens532 /// @param amount amount of tokens to mint533 /// @dev EVM selector for this function is: 0x40c10f19,534 /// or in textual repr: mint(address,uint256)535 function mint(address to, uint256 amount) public returns (bool) {536 require(false, stub_error);537 to;538 amount;539 dummy = 0;540 return false;541 }542}543544/// @dev inlined interface545contract ERC20Events {546 event Transfer(address indexed from, address indexed to, uint256 value);547 event Approval(address indexed owner, address indexed spender, uint256 value);548}549550/// @dev the ERC-165 identifier for this interface is 0x942e8b22551contract ERC20 is Dummy, ERC165, ERC20Events {552 /// @dev EVM selector for this function is: 0x06fdde03,553 /// or in textual repr: name()554 function name() public view returns (string memory) {555 require(false, stub_error);556 dummy;557 return "";558 }559560 /// @dev EVM selector for this function is: 0x95d89b41,561 /// or in textual repr: symbol()562 function symbol() public view returns (string memory) {563 require(false, stub_error);564 dummy;565 return "";566 }567568 /// @dev EVM selector for this function is: 0x18160ddd,569 /// or in textual repr: totalSupply()570 function totalSupply() public view returns (uint256) {571 require(false, stub_error);572 dummy;573 return 0;574 }575576 /// @dev EVM selector for this function is: 0x313ce567,577 /// or in textual repr: decimals()578 function decimals() public view returns (uint8) {579 require(false, stub_error);580 dummy;581 return 0;582 }583584 /// @dev EVM selector for this function is: 0x70a08231,585 /// or in textual repr: balanceOf(address)586 function balanceOf(address owner) public view returns (uint256) {587 require(false, stub_error);588 owner;589 dummy;590 return 0;591 }592593 /// @dev EVM selector for this function is: 0xa9059cbb,594 /// or in textual repr: transfer(address,uint256)595 function transfer(address to, uint256 amount) public returns (bool) {596 require(false, stub_error);597 to;598 amount;599 dummy = 0;600 return false;601 }602603 /// @dev EVM selector for this function is: 0x23b872dd,604 /// or in textual repr: transferFrom(address,address,uint256)605 function transferFrom(606 address from,607 address to,608 uint256 amount609 ) public returns (bool) {610 require(false, stub_error);611 from;612 to;613 amount;614 dummy = 0;615 return false;616 }617618 /// @dev EVM selector for this function is: 0x095ea7b3,619 /// or in textual repr: approve(address,uint256)620 function approve(address spender, uint256 amount) public returns (bool) {621 require(false, stub_error);622 spender;623 amount;624 dummy = 0;625 return false;626 }627628 /// @dev EVM selector for this function is: 0xdd62ed3e,629 /// or in textual repr: allowance(address,address)630 function allowance(address owner, address spender) public view returns (uint256) {631 require(false, stub_error);632 owner;633 spender;634 dummy;635 return 0;636 }637}638639contract UniqueFungible is Dummy, ERC165, ERC20, ERC20Mintable, ERC20UniqueExtensions, Collection {}1// SPDX-License-Identifier: OTHER2// This code is automatically generated34pragma solidity >=0.8.0 <0.9.0;56/// @dev common stubs holder7contract Dummy {8 uint8 dummy;9 string stub_error = "this contract is implemented in native";10}1112contract ERC165 is Dummy {13 function supportsInterface(bytes4 interfaceID) external view returns (bool) {14 require(false, stub_error);15 interfaceID;16 return true;17 }18}1920/// @title A contract that allows you to work with collections.21/// @dev the ERC-165 identifier for this interface is 0xcc1d80ca22contract Collection is Dummy, ERC165 {23 // /// Set collection property.24 // ///25 // /// @param key Property key.26 // /// @param value Propery value.27 // /// @dev EVM selector for this function is: 0x2f073f66,28 // /// or in textual repr: setCollectionProperty(string,bytes)29 // function setCollectionProperty(string memory key, bytes memory value) public {30 // require(false, stub_error);31 // key;32 // value;33 // dummy = 0;34 // }3536 /// Set collection properties.37 ///38 /// @param properties Vector of properties key/value pair.39 /// @dev EVM selector for this function is: 0x50b26b2a,40 /// or in textual repr: setCollectionProperties((string,bytes)[])41 function setCollectionProperties(Property[] memory properties) public {42 require(false, stub_error);43 properties;44 dummy = 0;45 }4647 // /// Delete collection property.48 // ///49 // /// @param key Property key.50 // /// @dev EVM selector for this function is: 0x7b7debce,51 // /// or in textual repr: deleteCollectionProperty(string)52 // function deleteCollectionProperty(string memory key) public {53 // require(false, stub_error);54 // key;55 // dummy = 0;56 // }5758 /// Delete collection properties.59 ///60 /// @param keys Properties keys.61 /// @dev EVM selector for this function is: 0xee206ee3,62 /// or in textual repr: deleteCollectionProperties(string[])63 function deleteCollectionProperties(string[] memory keys) public {64 require(false, stub_error);65 keys;66 dummy = 0;67 }6869 /// Get collection property.70 ///71 /// @dev Throws error if key not found.72 ///73 /// @param key Property key.74 /// @return bytes The property corresponding to the key.75 /// @dev EVM selector for this function is: 0xcf24fd6d,76 /// or in textual repr: collectionProperty(string)77 function collectionProperty(string memory key) public view returns (bytes memory) {78 require(false, stub_error);79 key;80 dummy;81 return hex"";82 }8384 /// Get collection properties.85 ///86 /// @param keys Properties keys. Empty keys for all propertyes.87 /// @return Vector of properties key/value pairs.88 /// @dev EVM selector for this function is: 0x285fb8e6,89 /// or in textual repr: collectionProperties(string[])90 function collectionProperties(string[] memory keys) public view returns (Property[] memory) {91 require(false, stub_error);92 keys;93 dummy;94 return new Property[](0);95 }9697 // /// Set the sponsor of the collection.98 // ///99 // /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.100 // ///101 // /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.102 // /// @dev EVM selector for this function is: 0x7623402e,103 // /// or in textual repr: setCollectionSponsor(address)104 // function setCollectionSponsor(address sponsor) public {105 // require(false, stub_error);106 // sponsor;107 // dummy = 0;108 // }109110 /// Set the sponsor of the collection.111 ///112 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.113 ///114 /// @param sponsor Cross account address of the sponsor from whose account funds will be debited for operations with the contract.115 /// @dev EVM selector for this function is: 0x84a1d5a8,116 /// or in textual repr: setCollectionSponsorCross((address,uint256))117 function setCollectionSponsorCross(EthCrossAccount memory sponsor) public {118 require(false, stub_error);119 sponsor;120 dummy = 0;121 }122123 /// Whether there is a pending sponsor.124 /// @dev EVM selector for this function is: 0x058ac185,125 /// or in textual repr: hasCollectionPendingSponsor()126 function hasCollectionPendingSponsor() public view returns (bool) {127 require(false, stub_error);128 dummy;129 return false;130 }131132 /// Collection sponsorship confirmation.133 ///134 /// @dev After setting the sponsor for the collection, it must be confirmed with this function.135 /// @dev EVM selector for this function is: 0x3c50e97a,136 /// or in textual repr: confirmCollectionSponsorship()137 function confirmCollectionSponsorship() public {138 require(false, stub_error);139 dummy = 0;140 }141142 /// Remove collection sponsor.143 /// @dev EVM selector for this function is: 0x6e0326a3,144 /// or in textual repr: removeCollectionSponsor()145 function removeCollectionSponsor() public {146 require(false, stub_error);147 dummy = 0;148 }149150 /// Get current sponsor.151 ///152 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.153 /// @dev EVM selector for this function is: 0x6ec0a9f1,154 /// or in textual repr: collectionSponsor()155 function collectionSponsor() public view returns (Tuple8 memory) {156 require(false, stub_error);157 dummy;158 return Tuple8(0x0000000000000000000000000000000000000000, 0);159 }160161 /// Set limits for the collection.162 /// @dev Throws error if limit not found.163 /// @param limit Name of the limit. Valid names:164 /// "accountTokenOwnershipLimit",165 /// "sponsoredDataSize",166 /// "sponsoredDataRateLimit",167 /// "tokenLimit",168 /// "sponsorTransferTimeout",169 /// "sponsorApproveTimeout"170 /// "ownerCanTransfer",171 /// "ownerCanDestroy",172 /// "transfersEnabled"173 /// @param value Value of the limit.174 /// @dev EVM selector for this function is: 0x4ad890a8,175 /// or in textual repr: setCollectionLimit(string,uint256)176 function setCollectionLimit(string memory limit, uint256 value) public {177 require(false, stub_error);178 limit;179 value;180 dummy = 0;181 }182183 /// Get contract address.184 /// @dev EVM selector for this function is: 0xf6b4dfb4,185 /// or in textual repr: contractAddress()186 function contractAddress() public view returns (address) {187 require(false, stub_error);188 dummy;189 return 0x0000000000000000000000000000000000000000;190 }191192 /// Add collection admin.193 /// @param newAdmin Cross account administrator address.194 /// @dev EVM selector for this function is: 0x859aa7d6,195 /// or in textual repr: addCollectionAdminCross((address,uint256))196 function addCollectionAdminCross(EthCrossAccount memory newAdmin) public {197 require(false, stub_error);198 newAdmin;199 dummy = 0;200 }201202 /// Remove collection admin.203 /// @param admin Cross account administrator address.204 /// @dev EVM selector for this function is: 0x6c0cd173,205 /// or in textual repr: removeCollectionAdminCross((address,uint256))206 function removeCollectionAdminCross(EthCrossAccount memory admin) public {207 require(false, stub_error);208 admin;209 dummy = 0;210 }211212 // /// Add collection admin.213 // /// @param newAdmin Address of the added administrator.214 // /// @dev EVM selector for this function is: 0x92e462c7,215 // /// or in textual repr: addCollectionAdmin(address)216 // function addCollectionAdmin(address newAdmin) public {217 // require(false, stub_error);218 // newAdmin;219 // dummy = 0;220 // }221222 // /// Remove collection admin.223 // ///224 // /// @param admin Address of the removed administrator.225 // /// @dev EVM selector for this function is: 0xfafd7b42,226 // /// or in textual repr: removeCollectionAdmin(address)227 // function removeCollectionAdmin(address admin) public {228 // require(false, stub_error);229 // admin;230 // dummy = 0;231 // }232233 /// Toggle accessibility of collection nesting.234 ///235 /// @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'236 /// @dev EVM selector for this function is: 0x112d4586,237 /// or in textual repr: setCollectionNesting(bool)238 function setCollectionNesting(bool enable) public {239 require(false, stub_error);240 enable;241 dummy = 0;242 }243244 /// Toggle accessibility of collection nesting.245 ///246 /// @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'247 /// @param collections Addresses of collections that will be available for nesting.248 /// @dev EVM selector for this function is: 0x64872396,249 /// or in textual repr: setCollectionNesting(bool,address[])250 function setCollectionNesting(bool enable, address[] memory collections) public {251 require(false, stub_error);252 enable;253 collections;254 dummy = 0;255 }256257 /// Set the collection access method.258 /// @param mode Access mode259 /// 0 for Normal260 /// 1 for AllowList261 /// @dev EVM selector for this function is: 0x41835d4c,262 /// or in textual repr: setCollectionAccess(uint8)263 function setCollectionAccess(uint8 mode) public {264 require(false, stub_error);265 mode;266 dummy = 0;267 }268269 /// Checks that user allowed to operate with collection.270 ///271 /// @param user User address to check.272 /// @dev EVM selector for this function is: 0x91b6df49,273 /// or in textual repr: allowlistedCross((address,uint256))274 function allowlistedCross(EthCrossAccount memory user) public view returns (bool) {275 require(false, stub_error);276 user;277 dummy;278 return false;279 }280281 // /// Add the user to the allowed list.282 // ///283 // /// @param user Address of a trusted user.284 // /// @dev EVM selector for this function is: 0x67844fe6,285 // /// or in textual repr: addToCollectionAllowList(address)286 // function addToCollectionAllowList(address user) public {287 // require(false, stub_error);288 // user;289 // dummy = 0;290 // }291292 /// Add user to allowed list.293 ///294 /// @param user User cross account address.295 /// @dev EVM selector for this function is: 0xa0184a3a,296 /// or in textual repr: addToCollectionAllowListCross((address,uint256))297 function addToCollectionAllowListCross(EthCrossAccount memory user) public {298 require(false, stub_error);299 user;300 dummy = 0;301 }302303 // /// Remove the user from the allowed list.304 // ///305 // /// @param user Address of a removed user.306 // /// @dev EVM selector for this function is: 0x85c51acb,307 // /// or in textual repr: removeFromCollectionAllowList(address)308 // function removeFromCollectionAllowList(address user) public {309 // require(false, stub_error);310 // user;311 // dummy = 0;312 // }313314 /// Remove user from allowed list.315 ///316 /// @param user User cross account address.317 /// @dev EVM selector for this function is: 0x09ba452a,318 /// or in textual repr: removeFromCollectionAllowListCross((address,uint256))319 function removeFromCollectionAllowListCross(EthCrossAccount memory user) public {320 require(false, stub_error);321 user;322 dummy = 0;323 }324325 /// Switch permission for minting.326 ///327 /// @param mode Enable if "true".328 /// @dev EVM selector for this function is: 0x00018e84,329 /// or in textual repr: setCollectionMintMode(bool)330 function setCollectionMintMode(bool mode) public {331 require(false, stub_error);332 mode;333 dummy = 0;334 }335336 // /// Check that account is the owner or admin of the collection337 // ///338 // /// @param user account to verify339 // /// @return "true" if account is the owner or admin340 // /// @dev EVM selector for this function is: 0x9811b0c7,341 // /// or in textual repr: isOwnerOrAdmin(address)342 // function isOwnerOrAdmin(address user) public view returns (bool) {343 // require(false, stub_error);344 // user;345 // dummy;346 // return false;347 // }348349 /// Check that account is the owner or admin of the collection350 ///351 /// @param user User cross account to verify352 /// @return "true" if account is the owner or admin353 /// @dev EVM selector for this function is: 0x3e75a905,354 /// or in textual repr: isOwnerOrAdminCross((address,uint256))355 function isOwnerOrAdminCross(EthCrossAccount memory user) public view returns (bool) {356 require(false, stub_error);357 user;358 dummy;359 return false;360 }361362 /// Returns collection type363 ///364 /// @return `Fungible` or `NFT` or `ReFungible`365 /// @dev EVM selector for this function is: 0xd34b55b8,366 /// or in textual repr: uniqueCollectionType()367 function uniqueCollectionType() public view returns (string memory) {368 require(false, stub_error);369 dummy;370 return "";371 }372373 /// Get collection owner.374 ///375 /// @return Tuble with sponsor address and his substrate mirror.376 /// If address is canonical then substrate mirror is zero and vice versa.377 /// @dev EVM selector for this function is: 0xdf727d3b,378 /// or in textual repr: collectionOwner()379 function collectionOwner() public view returns (EthCrossAccount memory) {380 require(false, stub_error);381 dummy;382 return EthCrossAccount(0x0000000000000000000000000000000000000000, 0);383 }384385 // /// Changes collection owner to another account386 // ///387 // /// @dev Owner can be changed only by current owner388 // /// @param newOwner new owner account389 // /// @dev EVM selector for this function is: 0x4f53e226,390 // /// or in textual repr: changeCollectionOwner(address)391 // function changeCollectionOwner(address newOwner) public {392 // require(false, stub_error);393 // newOwner;394 // dummy = 0;395 // }396397 /// Get collection administrators398 ///399 /// @return Vector of tuples with admins address and his substrate mirror.400 /// If address is canonical then substrate mirror is zero and vice versa.401 /// @dev EVM selector for this function is: 0x5813216b,402 /// or in textual repr: collectionAdmins()403 function collectionAdmins() public view returns (EthCrossAccount[] memory) {404 require(false, stub_error);405 dummy;406 return new EthCrossAccount[](0);407 }408409 /// Changes collection owner to another account410 ///411 /// @dev Owner can be changed only by current owner412 /// @param newOwner new owner cross account413 /// @dev EVM selector for this function is: 0x6496c497,414 /// or in textual repr: changeCollectionOwnerCross((address,uint256))415 function changeCollectionOwnerCross(EthCrossAccount memory newOwner) public {416 require(false, stub_error);417 newOwner;418 dummy = 0;419 }420}421422/// @dev Cross account struct423struct EthCrossAccount {424 address eth;425 uint256 sub;426}427428/// @dev Property struct429struct Property {430 string key;431 bytes value;432}433434/// @dev the ERC-165 identifier for this interface is 0x5b7038cf435contract ERC20UniqueExtensions is Dummy, ERC165 {436 /// @notice A description for the collection.437 /// @dev EVM selector for this function is: 0x7284e416,438 /// or in textual repr: description()439 function description() public view returns (string memory) {440 require(false, stub_error);441 dummy;442 return "";443 }444445 /// @dev EVM selector for this function is: 0x0ecd0ab0,446 /// or in textual repr: approveCross((address,uint256),uint256)447 function approveCross(EthCrossAccount memory spender, uint256 amount) public returns (bool) {448 require(false, stub_error);449 spender;450 amount;451 dummy = 0;452 return false;453 }454455 // /// Burn tokens from account456 // /// @dev Function that burns an `amount` of the tokens of a given account,457 // /// deducting from the sender's allowance for said account.458 // /// @param from The account whose tokens will be burnt.459 // /// @param amount The amount that will be burnt.460 // /// @dev EVM selector for this function is: 0x79cc6790,461 // /// or in textual repr: burnFrom(address,uint256)462 // function burnFrom(address from, uint256 amount) public returns (bool) {463 // require(false, stub_error);464 // from;465 // amount;466 // dummy = 0;467 // return false;468 // }469470 /// Burn tokens from account471 /// @dev Function that burns an `amount` of the tokens of a given account,472 /// deducting from the sender's allowance for said account.473 /// @param from The account whose tokens will be burnt.474 /// @param amount The amount that will be burnt.475 /// @dev EVM selector for this function is: 0xbb2f5a58,476 /// or in textual repr: burnFromCross((address,uint256),uint256)477 function burnFromCross(EthCrossAccount memory from, uint256 amount) public returns (bool) {478 require(false, stub_error);479 from;480 amount;481 dummy = 0;482 return false;483 }484485 /// Mint tokens for multiple accounts.486 /// @param amounts array of pairs of account address and amount487 /// @dev EVM selector for this function is: 0x1acf2d55,488 /// or in textual repr: mintBulk((address,uint256)[])489 function mintBulk(Tuple8[] memory amounts) public returns (bool) {490 require(false, stub_error);491 amounts;492 dummy = 0;493 return false;494 }495496 /// @dev EVM selector for this function is: 0x2ada85ff,497 /// or in textual repr: transferCross((address,uint256),uint256)498 function transferCross(EthCrossAccount memory to, uint256 amount) public returns (bool) {499 require(false, stub_error);500 to;501 amount;502 dummy = 0;503 return false;504 }505506 /// @dev EVM selector for this function is: 0xd5cf430b,507 /// or in textual repr: transferFromCross((address,uint256),(address,uint256),uint256)508 function transferFromCross(509 EthCrossAccount memory from,510 EthCrossAccount memory to,511 uint256 amount512 ) public returns (bool) {513 require(false, stub_error);514 from;515 to;516 amount;517 dummy = 0;518 return false;519 }520}521522/// @dev anonymous struct523struct Tuple8 {524 address field_0;525 uint256 field_1;526}527528/// @dev the ERC-165 identifier for this interface is 0x40c10f19529contract ERC20Mintable is Dummy, ERC165 {530 /// Mint tokens for `to` account.531 /// @param to account that will receive minted tokens532 /// @param amount amount of tokens to mint533 /// @dev EVM selector for this function is: 0x40c10f19,534 /// or in textual repr: mint(address,uint256)535 function mint(address to, uint256 amount) public returns (bool) {536 require(false, stub_error);537 to;538 amount;539 dummy = 0;540 return false;541 }542}543544/// @dev inlined interface545contract ERC20Events {546 event Transfer(address indexed from, address indexed to, uint256 value);547 event Approval(address indexed owner, address indexed spender, uint256 value);548}549550/// @dev the ERC-165 identifier for this interface is 0x8cb847c4551contract ERC20 is Dummy, ERC165, ERC20Events {552 /// @dev EVM selector for this function is: 0x06fdde03,553 /// or in textual repr: name()554 function name() public view returns (string memory) {555 require(false, stub_error);556 dummy;557 return "";558 }559560 /// @dev EVM selector for this function is: 0x95d89b41,561 /// or in textual repr: symbol()562 function symbol() public view returns (string memory) {563 require(false, stub_error);564 dummy;565 return "";566 }567568 /// @dev EVM selector for this function is: 0x18160ddd,569 /// or in textual repr: totalSupply()570 function totalSupply() public view returns (uint256) {571 require(false, stub_error);572 dummy;573 return 0;574 }575576 /// @dev EVM selector for this function is: 0x313ce567,577 /// or in textual repr: decimals()578 function decimals() public view returns (uint8) {579 require(false, stub_error);580 dummy;581 return 0;582 }583584 /// @dev EVM selector for this function is: 0x70a08231,585 /// or in textual repr: balanceOf(address)586 function balanceOf(address owner) public view returns (uint256) {587 require(false, stub_error);588 owner;589 dummy;590 return 0;591 }592593 /// @dev EVM selector for this function is: 0xa9059cbb,594 /// or in textual repr: transfer(address,uint256)595 function transfer(address to, uint256 amount) public returns (bool) {596 require(false, stub_error);597 to;598 amount;599 dummy = 0;600 return false;601 }602603 /// @dev EVM selector for this function is: 0x23b872dd,604 /// or in textual repr: transferFrom(address,address,uint256)605 function transferFrom(606 address from,607 address to,608 uint256 amount609 ) public returns (bool) {610 require(false, stub_error);611 from;612 to;613 amount;614 dummy = 0;615 return false;616 }617618 /// @dev EVM selector for this function is: 0x095ea7b3,619 /// or in textual repr: approve(address,uint256)620 function approve(address spender, uint256 amount) public returns (bool) {621 require(false, stub_error);622 spender;623 amount;624 dummy = 0;625 return false;626 }627628 /// @dev EVM selector for this function is: 0xdd62ed3e,629 /// or in textual repr: allowance(address,address)630 function allowance(address owner, address spender) public view returns (uint256) {631 require(false, stub_error);632 owner;633 spender;634 dummy;635 return 0;636 }637638 /// @notice Returns collection helper contract address639 /// @dev EVM selector for this function is: 0x1896cce6,640 /// or in textual repr: collectionHelperAddress()641 function collectionHelperAddress() public view returns (address) {642 require(false, stub_error);643 dummy;644 return 0x0000000000000000000000000000000000000000;645 }646}647648contract UniqueFungible is Dummy, ERC165, ERC20, ERC20Mintable, ERC20UniqueExtensions, Collection {}pallets/nonfungible/src/erc.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -42,6 +42,7 @@
use pallet_evm::{account::CrossAccountId, PrecompileHandle};
use pallet_evm_coder_substrate::call;
use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};
+use sp_core::Get;
use crate::{
AccountBalance, Config, CreateItemData, NonfungibleHandle, Pallet, TokenData, TokensMinted,
@@ -489,6 +490,11 @@
// TODO: Not implemetable
Err("not implemented".into())
}
+
+ /// @notice Returns collection helper contract address
+ fn collection_helper_address(&self) -> Result<address> {
+ Ok(T::ContractAddress::get())
+ }
}
/// @title ERC721 Token that can be irreversibly burned (destroyed).
pallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth--- a/pallets/nonfungible/src/stubs/UniqueNFT.sol
+++ b/pallets/nonfungible/src/stubs/UniqueNFT.sol
@@ -920,7 +920,7 @@
/// @title ERC-721 Non-Fungible Token Standard
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
-/// @dev the ERC-165 identifier for this interface is 0x80ac58cd
+/// @dev the ERC-165 identifier for this interface is 0x983a942b
contract ERC721 is Dummy, ERC165, ERC721Events {
/// @notice Count all NFTs assigned to an owner
/// @dev NFTs assigned to the zero address are considered invalid, and this
@@ -1050,6 +1050,15 @@
dummy;
return 0x0000000000000000000000000000000000000000;
}
+
+ /// @notice Returns collection helper contract address
+ /// @dev EVM selector for this function is: 0x1896cce6,
+ /// or in textual repr: collectionHelperAddress()
+ function collectionHelperAddress() public view returns (address) {
+ require(false, stub_error);
+ dummy;
+ return 0x0000000000000000000000000000000000000000;
+ }
}
contract UniqueNFT is
pallets/refungible/src/erc.rsdiffbeforeafterboth--- a/pallets/refungible/src/erc.rs
+++ b/pallets/refungible/src/erc.rs
@@ -38,7 +38,7 @@
use pallet_evm::{account::CrossAccountId, PrecompileHandle};
use pallet_evm_coder_substrate::{call, dispatch_to_evm};
use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};
-use sp_core::H160;
+use sp_core::{H160, Get};
use sp_std::{collections::btree_map::BTreeMap, vec::Vec, vec};
use up_data_structs::{
CollectionId, CollectionPropertiesVec, mapping::TokenAddressMapping, Property, PropertyKey,
@@ -482,6 +482,11 @@
// TODO: Not implemetable
Err("not implemented".into())
}
+
+ /// @notice Returns collection helper contract address
+ fn collection_helper_address(&self) -> Result<address> {
+ Ok(T::ContractAddress::get())
+ }
}
/// Returns amount of pieces of `token` that `owner` have
pallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth--- a/pallets/refungible/src/stubs/UniqueRefungible.sol
+++ b/pallets/refungible/src/stubs/UniqueRefungible.sol
@@ -919,7 +919,7 @@
/// @title ERC-721 Non-Fungible Token Standard
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
-/// @dev the ERC-165 identifier for this interface is 0x58800161
+/// @dev the ERC-165 identifier for this interface is 0x4016cd87
contract ERC721 is Dummy, ERC165, ERC721Events {
/// @notice Count all RFTs assigned to an owner
/// @dev RFTs assigned to the zero address are considered invalid, and this
@@ -1047,6 +1047,15 @@
dummy;
return 0x0000000000000000000000000000000000000000;
}
+
+ /// @notice Returns collection helper contract address
+ /// @dev EVM selector for this function is: 0x1896cce6,
+ /// or in textual repr: collectionHelperAddress()
+ function collectionHelperAddress() public view returns (address) {
+ require(false, stub_error);
+ dummy;
+ return 0x0000000000000000000000000000000000000000;
+ }
}
contract UniqueRefungible is
tests/src/apiConsts.test.tsdiffbeforeafterboth--- a/tests/src/apiConsts.test.ts
+++ b/tests/src/apiConsts.test.ts
@@ -117,4 +117,4 @@
function checkConst<T>(constValue: any, expectedValue: T) {
expect(constValue.toBigInt()).equal(expectedValue);
-}
+}
\ No newline at end of file
tests/src/eth/abi/fungible.jsondiffbeforeafterboth--- a/tests/src/eth/abi/fungible.json
+++ b/tests/src/eth/abi/fungible.json
@@ -201,6 +201,13 @@
},
{
"inputs": [],
+ "name": "collectionHelperAddress",
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
"name": "collectionOwner",
"outputs": [
{
tests/src/eth/abi/nonFungible.jsondiffbeforeafterboth--- a/tests/src/eth/abi/nonFungible.json
+++ b/tests/src/eth/abi/nonFungible.json
@@ -231,6 +231,13 @@
},
{
"inputs": [],
+ "name": "collectionHelperAddress",
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
"name": "collectionOwner",
"outputs": [
{
tests/src/eth/abi/reFungible.jsondiffbeforeafterboth--- a/tests/src/eth/abi/reFungible.json
+++ b/tests/src/eth/abi/reFungible.json
@@ -213,6 +213,13 @@
},
{
"inputs": [],
+ "name": "collectionHelperAddress",
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
"name": "collectionOwner",
"outputs": [
{
tests/src/eth/api/UniqueFungible.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueFungible.sol
+++ b/tests/src/eth/api/UniqueFungible.sol
@@ -354,7 +354,7 @@
event Approval(address indexed owner, address indexed spender, uint256 value);
}
-/// @dev the ERC-165 identifier for this interface is 0x942e8b22
+/// @dev the ERC-165 identifier for this interface is 0x8cb847c4
interface ERC20 is Dummy, ERC165, ERC20Events {
/// @dev EVM selector for this function is: 0x06fdde03,
/// or in textual repr: name()
@@ -395,6 +395,11 @@
/// @dev EVM selector for this function is: 0xdd62ed3e,
/// or in textual repr: allowance(address,address)
function allowance(address owner, address spender) external view returns (uint256);
+
+ /// @notice Returns collection helper contract address
+ /// @dev EVM selector for this function is: 0x1896cce6,
+ /// or in textual repr: collectionHelperAddress()
+ function collectionHelperAddress() external view returns (address);
}
interface UniqueFungible is Dummy, ERC165, ERC20, ERC20Mintable, ERC20UniqueExtensions, Collection {}
tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueNFT.sol
+++ b/tests/src/eth/api/UniqueNFT.sol
@@ -605,7 +605,7 @@
/// @title ERC-721 Non-Fungible Token Standard
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
-/// @dev the ERC-165 identifier for this interface is 0x80ac58cd
+/// @dev the ERC-165 identifier for this interface is 0x983a942b
interface ERC721 is Dummy, ERC165, ERC721Events {
/// @notice Count all NFTs assigned to an owner
/// @dev NFTs assigned to the zero address are considered invalid, and this
@@ -685,6 +685,11 @@
/// @dev EVM selector for this function is: 0xe985e9c5,
/// or in textual repr: isApprovedForAll(address,address)
function isApprovedForAll(address owner, address operator) external view returns (address);
+
+ /// @notice Returns collection helper contract address
+ /// @dev EVM selector for this function is: 0x1896cce6,
+ /// or in textual repr: collectionHelperAddress()
+ function collectionHelperAddress() external view returns (address);
}
interface UniqueNFT is
tests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueRefungible.sol
+++ b/tests/src/eth/api/UniqueRefungible.sol
@@ -604,7 +604,7 @@
/// @title ERC-721 Non-Fungible Token Standard
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
-/// @dev the ERC-165 identifier for this interface is 0x58800161
+/// @dev the ERC-165 identifier for this interface is 0x4016cd87
interface ERC721 is Dummy, ERC165, ERC721Events {
/// @notice Count all RFTs assigned to an owner
/// @dev RFTs assigned to the zero address are considered invalid, and this
@@ -682,6 +682,11 @@
/// @dev EVM selector for this function is: 0xe985e9c5,
/// or in textual repr: isApprovedForAll(address,address)
function isApprovedForAll(address owner, address operator) external view returns (address);
+
+ /// @notice Returns collection helper contract address
+ /// @dev EVM selector for this function is: 0x1896cce6,
+ /// or in textual repr: collectionHelperAddress()
+ function collectionHelperAddress() external view returns (address);
}
interface UniqueRefungible is
tests/src/eth/collectionHelperAddress.test.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/eth/collectionHelperAddress.test.ts
@@ -0,0 +1,57 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+import {itEth, usingEthPlaygrounds, expect} from './util';
+import {IKeyringPair} from '@polkadot/types/types';
+
+const EVM_COLLECTION_HELPERS_ADDRESS = '0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f';
+
+describe('[eth]CollectionHelerpAddress test: ERC721 ', () => {
+ let donor: IKeyringPair;
+
+ before(async function() {
+ await usingEthPlaygrounds(async (helper, privateKey) => {
+ donor = await privateKey({filename: __filename});
+ });
+ });
+
+ itEth('NFT\\RFT', async ({helper}) => {
+ const owner = await helper.eth.createAccountWithBalance(donor);
+
+ const {collectionAddress: nftCollectionAddress} = await helper.eth.createNFTCollection(owner, 'Sponsor', 'absolutely anything', 'ROC');
+ const nftCollection = helper.ethNativeContract.collection(nftCollectionAddress, 'nft', owner);
+
+ const {collectionAddress: rftCollectionAddress} = await helper.eth.createRFTCollection(owner, 'Sponsor', 'absolutely anything', 'ROC');
+ const rftCollection = helper.ethNativeContract.collection(rftCollectionAddress, 'rft', owner);
+
+ expect((await nftCollection.methods.collectionHelperAddress().call())
+ .toString().toLowerCase()).to.be.equal(EVM_COLLECTION_HELPERS_ADDRESS);
+
+ expect((await rftCollection.methods.collectionHelperAddress().call())
+ .toString().toLowerCase()).to.be.equal(EVM_COLLECTION_HELPERS_ADDRESS);
+ });
+
+ itEth('FT', async ({helper}) => {
+ const owner = await helper.eth.createAccountWithBalance(donor);
+
+ const {collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Sponsor', 18, 'absolutely anything', 'ROC');
+ const collection = helper.ethNativeContract.collection(collectionAddress, 'ft', owner);
+
+ expect((await collection.methods.collectionHelperAddress().call())
+ .toString().toLowerCase()).to.be.equal(EVM_COLLECTION_HELPERS_ADDRESS);
+ });
+
+});