difftreelog
Merge pull request #919 from UniqueNetwork/feature/crossBalanceOf
in: master
26 files changed
pallets/fungible/src/erc.rsdiffbeforeafterboth--- a/pallets/fungible/src/erc.rs
+++ b/pallets/fungible/src/erc.rs
@@ -327,6 +327,15 @@
fn collection_helper_address(&self) -> Result<Address> {
Ok(T::ContractAddress::get())
}
+
+ /// @notice Balance of account
+ /// @param owner An cross address for whom to query the balance
+ /// @return The number of fingibles owned by `owner`, possibly zero
+ fn balance_of_cross(&self, owner: CrossAddress) -> Result<U256> {
+ self.consume_store_reads(1)?;
+ let balance = <Balance<T>>::get((self.id, owner.into_sub_cross_account::<T>()?));
+ Ok(balance.into())
+ }
}
#[solidity_interface(
pallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterbothbinary blob — no preview
pallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth--- a/pallets/fungible/src/stubs/UniqueFungible.sol
+++ b/pallets/fungible/src/stubs/UniqueFungible.sol
@@ -511,7 +511,7 @@
bytes value;
}
-/// @dev the ERC-165 identifier for this interface is 0x85d7dea6
+/// @dev the ERC-165 identifier for this interface is 0x69d14d3e
contract ERC20UniqueExtensions is Dummy, ERC165 {
/// @dev Function to check the amount of tokens that an owner allowed to a spender.
/// @param owner crossAddress The address which owns the funds.
@@ -630,6 +630,18 @@
dummy;
return 0x0000000000000000000000000000000000000000;
}
+
+ /// @notice Balance of account
+ /// @param owner An cross address for whom to query the balance
+ /// @return The number of fingibles owned by `owner`, possibly zero
+ /// @dev EVM selector for this function is: 0xec069398,
+ /// or in textual repr: balanceOfCross((address,uint256))
+ function balanceOfCross(CrossAddress memory owner) public view returns (uint256) {
+ require(false, stub_error);
+ owner;
+ dummy;
+ return 0;
+ }
}
struct AmountForAddress {
pallets/nonfungible/src/erc.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -749,12 +749,29 @@
/// Returns the owner (in cross format) of the token.
///
/// @param tokenId Id for the token.
+ #[solidity(hide)]
fn cross_owner_of(&self, token_id: U256) -> Result<eth::CrossAddress> {
+ Self::owner_of_cross(&self, token_id)
+ }
+
+ /// Returns the owner (in cross format) of the token.
+ ///
+ /// @param tokenId Id for the token.
+ fn owner_of_cross(&self, token_id: U256) -> Result<eth::CrossAddress> {
Self::token_owner(&self, token_id.try_into()?)
.map(|o| eth::CrossAddress::from_sub_cross_account::<T>(&o))
.map_err(|_| Error::Revert("token not found".into()))
}
+ /// @notice Count all NFTs assigned to an owner
+ /// @param owner An cross address for whom to query the balance
+ /// @return The number of NFTs owned by `owner`, possibly zero
+ fn balance_of_cross(&self, owner: eth::CrossAddress) -> Result<U256> {
+ self.consume_store_reads(1)?;
+ let balance = <AccountBalance<T>>::get((self.id, owner.into_sub_cross_account::<T>()?));
+ Ok(balance.into())
+ }
+
/// Returns the token properties.
///
/// @param tokenId Id for the token.
pallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterbothbinary blob — no preview
pallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth--- a/pallets/nonfungible/src/stubs/UniqueNFT.sol
+++ b/pallets/nonfungible/src/stubs/UniqueNFT.sol
@@ -774,7 +774,7 @@
}
/// @title Unique extensions for ERC721.
-/// @dev the ERC-165 identifier for this interface is 0x16de3152
+/// @dev the ERC-165 identifier for this interface is 0x307b061a
contract ERC721UniqueExtensions is Dummy, ERC165 {
/// @notice A descriptive name for a collection of NFTs in this contract
/// @dev EVM selector for this function is: 0x06fdde03,
@@ -803,18 +803,42 @@
return "";
}
+ // /// Returns the owner (in cross format) of the token.
+ // ///
+ // /// @param tokenId Id for the token.
+ // /// @dev EVM selector for this function is: 0x2b29dace,
+ // /// or in textual repr: crossOwnerOf(uint256)
+ // function crossOwnerOf(uint256 tokenId) public view returns (CrossAddress memory) {
+ // require(false, stub_error);
+ // tokenId;
+ // dummy;
+ // return CrossAddress(0x0000000000000000000000000000000000000000,0);
+ // }
+
/// Returns the owner (in cross format) of the token.
///
/// @param tokenId Id for the token.
- /// @dev EVM selector for this function is: 0x2b29dace,
- /// or in textual repr: crossOwnerOf(uint256)
- function crossOwnerOf(uint256 tokenId) public view returns (CrossAddress memory) {
+ /// @dev EVM selector for this function is: 0xcaa3a4d0,
+ /// or in textual repr: ownerOfCross(uint256)
+ function ownerOfCross(uint256 tokenId) public view returns (CrossAddress memory) {
require(false, stub_error);
tokenId;
dummy;
return CrossAddress(0x0000000000000000000000000000000000000000, 0);
}
+ /// @notice Count all NFTs assigned to an owner
+ /// @param owner An cross address for whom to query the balance
+ /// @return The number of NFTs owned by `owner`, possibly zero
+ /// @dev EVM selector for this function is: 0xec069398,
+ /// or in textual repr: balanceOfCross((address,uint256))
+ function balanceOfCross(CrossAddress memory owner) public view returns (uint256) {
+ require(false, stub_error);
+ owner;
+ dummy;
+ return 0;
+ }
+
/// Returns the token properties.
///
/// @param tokenId Id for the token.
pallets/refungible/src/erc.rsdiffbeforeafterboth--- a/pallets/refungible/src/erc.rs
+++ b/pallets/refungible/src/erc.rs
@@ -783,7 +783,15 @@
/// Returns the owner (in cross format) of the token.
///
/// @param tokenId Id for the token.
+ #[solidity(hide)]
fn cross_owner_of(&self, token_id: U256) -> Result<eth::CrossAddress> {
+ Self::owner_of_cross(&self, token_id)
+ }
+
+ /// Returns the owner (in cross format) of the token.
+ ///
+ /// @param tokenId Id for the token.
+ fn owner_of_cross(&self, token_id: U256) -> Result<eth::CrossAddress> {
Self::token_owner(&self, token_id.try_into()?)
.map(|o| eth::CrossAddress::from_sub_cross_account::<T>(&o))
.or_else(|err| match err {
@@ -794,6 +802,15 @@
})
}
+ /// @notice Count all RFTs assigned to an owner
+ /// @param owner An cross address for whom to query the balance
+ /// @return The number of RFTs owned by `owner`, possibly zero
+ fn balance_of_cross(&self, owner: eth::CrossAddress) -> Result<U256> {
+ self.consume_store_reads(1)?;
+ let balance = <AccountBalance<T>>::get((self.id, owner.into_sub_cross_account::<T>()?));
+ Ok(balance.into())
+ }
+
/// Returns the token properties.
///
/// @param tokenId Id for the token.
pallets/refungible/src/erc_token.rsdiffbeforeafterboth--- a/pallets/refungible/src/erc_token.rs
+++ b/pallets/refungible/src/erc_token.rs
@@ -283,6 +283,16 @@
.map_err(dispatch_to_evm::<T>)?;
Ok(true)
}
+
+ /// @notice Balance of account
+ /// @param owner An cross address for whom to query the balance
+ /// @return The number of fingibles owned by `owner`, possibly zero
+ fn balance_of_cross(&self, owner: CrossAddress) -> Result<U256> {
+ self.consume_store_reads(1)?;
+ let balance = <Balance<T>>::get((self.id, self.1, owner.into_sub_cross_account::<T>()?));
+ Ok(balance.into())
+ }
+
/// @dev Function that changes total amount of the tokens.
/// Throws if `msg.sender` doesn't owns all of the tokens.
/// @param amount New total amount of the tokens.
pallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterbothbinary blob — no preview
pallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth--- a/pallets/refungible/src/stubs/UniqueRefungible.sol
+++ b/pallets/refungible/src/stubs/UniqueRefungible.sol
@@ -774,7 +774,7 @@
}
/// @title Unique extensions for ERC721.
-/// @dev the ERC-165 identifier for this interface is 0xb365c124
+/// @dev the ERC-165 identifier for this interface is 0x95c0f66c
contract ERC721UniqueExtensions is Dummy, ERC165 {
/// @notice A descriptive name for a collection of NFTs in this contract
/// @dev EVM selector for this function is: 0x06fdde03,
@@ -803,18 +803,42 @@
return "";
}
+ // /// Returns the owner (in cross format) of the token.
+ // ///
+ // /// @param tokenId Id for the token.
+ // /// @dev EVM selector for this function is: 0x2b29dace,
+ // /// or in textual repr: crossOwnerOf(uint256)
+ // function crossOwnerOf(uint256 tokenId) public view returns (CrossAddress memory) {
+ // require(false, stub_error);
+ // tokenId;
+ // dummy;
+ // return CrossAddress(0x0000000000000000000000000000000000000000,0);
+ // }
+
/// Returns the owner (in cross format) of the token.
///
/// @param tokenId Id for the token.
- /// @dev EVM selector for this function is: 0x2b29dace,
- /// or in textual repr: crossOwnerOf(uint256)
- function crossOwnerOf(uint256 tokenId) public view returns (CrossAddress memory) {
+ /// @dev EVM selector for this function is: 0xcaa3a4d0,
+ /// or in textual repr: ownerOfCross(uint256)
+ function ownerOfCross(uint256 tokenId) public view returns (CrossAddress memory) {
require(false, stub_error);
tokenId;
dummy;
return CrossAddress(0x0000000000000000000000000000000000000000, 0);
}
+ /// @notice Count all RFTs assigned to an owner
+ /// @param owner An cross address for whom to query the balance
+ /// @return The number of RFTs owned by `owner`, possibly zero
+ /// @dev EVM selector for this function is: 0xec069398,
+ /// or in textual repr: balanceOfCross((address,uint256))
+ function balanceOfCross(CrossAddress memory owner) public view returns (uint256) {
+ require(false, stub_error);
+ owner;
+ dummy;
+ return 0;
+ }
+
/// Returns the token properties.
///
/// @param tokenId Id for the token.
pallets/refungible/src/stubs/UniqueRefungibleToken.rawdiffbeforeafterbothbinary blob — no preview
pallets/refungible/src/stubs/UniqueRefungibleToken.soldiffbeforeafterboth--- a/pallets/refungible/src/stubs/UniqueRefungibleToken.sol
+++ b/pallets/refungible/src/stubs/UniqueRefungibleToken.sol
@@ -36,7 +36,7 @@
}
}
-/// @dev the ERC-165 identifier for this interface is 0x01d536fc
+/// @dev the ERC-165 identifier for this interface is 0xedd3a564
contract ERC20UniqueExtensions is Dummy, ERC165 {
/// @dev Function to check the amount of tokens that an owner allowed to a spender.
/// @param owner crossAddress The address which owns the funds.
@@ -97,6 +97,18 @@
return false;
}
+ /// @notice Balance of account
+ /// @param owner An cross address for whom to query the balance
+ /// @return The number of fingibles owned by `owner`, possibly zero
+ /// @dev EVM selector for this function is: 0xec069398,
+ /// or in textual repr: balanceOfCross((address,uint256))
+ function balanceOfCross(CrossAddress memory owner) public view returns (uint256) {
+ require(false, stub_error);
+ owner;
+ dummy;
+ return 0;
+ }
+
/// @dev Function that changes total amount of the tokens.
/// Throws if `msg.sender` doesn't owns all of the tokens.
/// @param amount New total amount of the tokens.
runtime/common/ethereum/sponsoring/refungible.rsdiffbeforeafterboth--- a/runtime/common/ethereum/sponsoring/refungible.rs
+++ b/runtime/common/ethereum/sponsoring/refungible.rs
@@ -227,6 +227,8 @@
| Symbol
| Description
| CrossOwnerOf { .. }
+ | OwnerOfCross { .. }
+ | BalanceOfCross { .. }
| Properties { .. }
| NextTokenId
| TokenContractAddress { .. }
@@ -341,9 +343,11 @@
ERC165Call(_, _) => None,
// Not sponsored
- AllowanceCross { .. } | BurnFrom { .. } | BurnFromCross { .. } | Repartition { .. } => {
- None
- }
+ AllowanceCross { .. }
+ | BalanceOfCross { .. }
+ | BurnFrom { .. }
+ | BurnFromCross { .. }
+ | Repartition { .. } => None,
TransferCross { .. } | TransferFromCross { .. } => {
let RefungibleTokenHandle(handle, token_id) = token;
tests/src/eth/abi/fungible.jsondiffbeforeafterboth--- a/tests/src/eth/abi/fungible.json
+++ b/tests/src/eth/abi/fungible.json
@@ -181,6 +181,23 @@
{ "internalType": "uint256", "name": "sub", "type": "uint256" }
],
"internalType": "struct CrossAddress",
+ "name": "owner",
+ "type": "tuple"
+ }
+ ],
+ "name": "balanceOfCross",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct CrossAddress",
"name": "from",
"type": "tuple"
},
tests/src/eth/abi/nonFungible.jsondiffbeforeafterboth--- a/tests/src/eth/abi/nonFungible.json
+++ b/tests/src/eth/abi/nonFungible.json
@@ -177,6 +177,23 @@
},
{
"inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct CrossAddress",
+ "name": "owner",
+ "type": "tuple"
+ }
+ ],
+ "name": "balanceOfCross",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }
],
"name": "burn",
@@ -386,25 +403,6 @@
},
{
"inputs": [
- { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
- ],
- "name": "crossOwnerOf",
- "outputs": [
- {
- "components": [
- { "internalType": "address", "name": "eth", "type": "address" },
- { "internalType": "uint256", "name": "sub", "type": "uint256" }
- ],
- "internalType": "struct CrossAddress",
- "name": "",
- "type": "tuple"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
{ "internalType": "string[]", "name": "keys", "type": "string[]" }
],
"name": "deleteCollectionProperties",
@@ -540,6 +538,25 @@
},
{
"inputs": [
+ { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+ ],
+ "name": "ownerOfCross",
+ "outputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct CrossAddress",
+ "name": "",
+ "type": "tuple"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
{ "internalType": "uint256", "name": "tokenId", "type": "uint256" },
{ "internalType": "string[]", "name": "keys", "type": "string[]" }
],
tests/src/eth/abi/reFungible.jsondiffbeforeafterboth1[2 {3 "anonymous": false,4 "inputs": [5 {6 "indexed": true,7 "internalType": "address",8 "name": "owner",9 "type": "address"10 },11 {12 "indexed": true,13 "internalType": "address",14 "name": "approved",15 "type": "address"16 },17 {18 "indexed": true,19 "internalType": "uint256",20 "name": "tokenId",21 "type": "uint256"22 }23 ],24 "name": "Approval",25 "type": "event"26 },27 {28 "anonymous": false,29 "inputs": [30 {31 "indexed": true,32 "internalType": "address",33 "name": "owner",34 "type": "address"35 },36 {37 "indexed": true,38 "internalType": "address",39 "name": "operator",40 "type": "address"41 },42 {43 "indexed": false,44 "internalType": "bool",45 "name": "approved",46 "type": "bool"47 }48 ],49 "name": "ApprovalForAll",50 "type": "event"51 },52 {53 "anonymous": false,54 "inputs": [55 {56 "indexed": true,57 "internalType": "uint256",58 "name": "tokenId",59 "type": "uint256"60 }61 ],62 "name": "TokenChanged",63 "type": "event"64 },65 {66 "anonymous": false,67 "inputs": [68 {69 "indexed": true,70 "internalType": "address",71 "name": "from",72 "type": "address"73 },74 {75 "indexed": true,76 "internalType": "address",77 "name": "to",78 "type": "address"79 },80 {81 "indexed": true,82 "internalType": "uint256",83 "name": "tokenId",84 "type": "uint256"85 }86 ],87 "name": "Transfer",88 "type": "event"89 },90 {91 "inputs": [92 {93 "components": [94 { "internalType": "address", "name": "eth", "type": "address" },95 { "internalType": "uint256", "name": "sub", "type": "uint256" }96 ],97 "internalType": "struct CrossAddress",98 "name": "newAdmin",99 "type": "tuple"100 }101 ],102 "name": "addCollectionAdminCross",103 "outputs": [],104 "stateMutability": "nonpayable",105 "type": "function"106 },107 {108 "inputs": [109 {110 "components": [111 { "internalType": "address", "name": "eth", "type": "address" },112 { "internalType": "uint256", "name": "sub", "type": "uint256" }113 ],114 "internalType": "struct CrossAddress",115 "name": "user",116 "type": "tuple"117 }118 ],119 "name": "addToCollectionAllowListCross",120 "outputs": [],121 "stateMutability": "nonpayable",122 "type": "function"123 },124 {125 "inputs": [126 {127 "components": [128 { "internalType": "address", "name": "eth", "type": "address" },129 { "internalType": "uint256", "name": "sub", "type": "uint256" }130 ],131 "internalType": "struct CrossAddress",132 "name": "user",133 "type": "tuple"134 }135 ],136 "name": "allowlistedCross",137 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],138 "stateMutability": "view",139 "type": "function"140 },141 {142 "inputs": [143 { "internalType": "address", "name": "approved", "type": "address" },144 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }145 ],146 "name": "approve",147 "outputs": [],148 "stateMutability": "nonpayable",149 "type": "function"150 },151 {152 "inputs": [153 { "internalType": "address", "name": "owner", "type": "address" }154 ],155 "name": "balanceOf",156 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],157 "stateMutability": "view",158 "type": "function"159 },160 {161 "inputs": [162 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }163 ],164 "name": "burn",165 "outputs": [],166 "stateMutability": "nonpayable",167 "type": "function"168 },169 {170 "inputs": [171 {172 "components": [173 { "internalType": "address", "name": "eth", "type": "address" },174 { "internalType": "uint256", "name": "sub", "type": "uint256" }175 ],176 "internalType": "struct CrossAddress",177 "name": "from",178 "type": "tuple"179 },180 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }181 ],182 "name": "burnFromCross",183 "outputs": [],184 "stateMutability": "nonpayable",185 "type": "function"186 },187 {188 "inputs": [189 {190 "components": [191 { "internalType": "address", "name": "eth", "type": "address" },192 { "internalType": "uint256", "name": "sub", "type": "uint256" }193 ],194 "internalType": "struct CrossAddress",195 "name": "newOwner",196 "type": "tuple"197 }198 ],199 "name": "changeCollectionOwnerCross",200 "outputs": [],201 "stateMutability": "nonpayable",202 "type": "function"203 },204 {205 "inputs": [],206 "name": "collectionAdmins",207 "outputs": [208 {209 "components": [210 { "internalType": "address", "name": "eth", "type": "address" },211 { "internalType": "uint256", "name": "sub", "type": "uint256" }212 ],213 "internalType": "struct CrossAddress[]",214 "name": "",215 "type": "tuple[]"216 }217 ],218 "stateMutability": "view",219 "type": "function"220 },221 {222 "inputs": [],223 "name": "collectionHelperAddress",224 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],225 "stateMutability": "view",226 "type": "function"227 },228 {229 "inputs": [],230 "name": "collectionLimits",231 "outputs": [232 {233 "components": [234 {235 "internalType": "enum CollectionLimitField",236 "name": "field",237 "type": "uint8"238 },239 {240 "components": [241 { "internalType": "bool", "name": "status", "type": "bool" },242 { "internalType": "uint256", "name": "value", "type": "uint256" }243 ],244 "internalType": "struct OptionUint256",245 "name": "value",246 "type": "tuple"247 }248 ],249 "internalType": "struct CollectionLimit[]",250 "name": "",251 "type": "tuple[]"252 }253 ],254 "stateMutability": "view",255 "type": "function"256 },257 {258 "inputs": [],259 "name": "collectionNestingPermissions",260 "outputs": [261 {262 "components": [263 {264 "internalType": "enum CollectionPermissionField",265 "name": "field",266 "type": "uint8"267 },268 { "internalType": "bool", "name": "value", "type": "bool" }269 ],270 "internalType": "struct CollectionNestingPermission[]",271 "name": "",272 "type": "tuple[]"273 }274 ],275 "stateMutability": "view",276 "type": "function"277 },278 {279 "inputs": [],280 "name": "collectionNestingRestrictedCollectionIds",281 "outputs": [282 {283 "components": [284 { "internalType": "bool", "name": "token_owner", "type": "bool" },285 { "internalType": "uint256[]", "name": "ids", "type": "uint256[]" }286 ],287 "internalType": "struct CollectionNesting",288 "name": "",289 "type": "tuple"290 }291 ],292 "stateMutability": "view",293 "type": "function"294 },295 {296 "inputs": [],297 "name": "collectionOwner",298 "outputs": [299 {300 "components": [301 { "internalType": "address", "name": "eth", "type": "address" },302 { "internalType": "uint256", "name": "sub", "type": "uint256" }303 ],304 "internalType": "struct CrossAddress",305 "name": "",306 "type": "tuple"307 }308 ],309 "stateMutability": "view",310 "type": "function"311 },312 {313 "inputs": [314 { "internalType": "string[]", "name": "keys", "type": "string[]" }315 ],316 "name": "collectionProperties",317 "outputs": [318 {319 "components": [320 { "internalType": "string", "name": "key", "type": "string" },321 { "internalType": "bytes", "name": "value", "type": "bytes" }322 ],323 "internalType": "struct Property[]",324 "name": "",325 "type": "tuple[]"326 }327 ],328 "stateMutability": "view",329 "type": "function"330 },331 {332 "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],333 "name": "collectionProperty",334 "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],335 "stateMutability": "view",336 "type": "function"337 },338 {339 "inputs": [],340 "name": "collectionSponsor",341 "outputs": [342 {343 "components": [344 { "internalType": "address", "name": "eth", "type": "address" },345 { "internalType": "uint256", "name": "sub", "type": "uint256" }346 ],347 "internalType": "struct CrossAddress",348 "name": "",349 "type": "tuple"350 }351 ],352 "stateMutability": "view",353 "type": "function"354 },355 {356 "inputs": [],357 "name": "confirmCollectionSponsorship",358 "outputs": [],359 "stateMutability": "nonpayable",360 "type": "function"361 },362 {363 "inputs": [],364 "name": "contractAddress",365 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],366 "stateMutability": "view",367 "type": "function"368 },369 {370 "inputs": [371 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }372 ],373 "name": "crossOwnerOf",374 "outputs": [375 {376 "components": [377 { "internalType": "address", "name": "eth", "type": "address" },378 { "internalType": "uint256", "name": "sub", "type": "uint256" }379 ],380 "internalType": "struct CrossAddress",381 "name": "",382 "type": "tuple"383 }384 ],385 "stateMutability": "view",386 "type": "function"387 },388 {389 "inputs": [390 { "internalType": "string[]", "name": "keys", "type": "string[]" }391 ],392 "name": "deleteCollectionProperties",393 "outputs": [],394 "stateMutability": "nonpayable",395 "type": "function"396 },397 {398 "inputs": [399 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },400 { "internalType": "string[]", "name": "keys", "type": "string[]" }401 ],402 "name": "deleteProperties",403 "outputs": [],404 "stateMutability": "nonpayable",405 "type": "function"406 },407 {408 "inputs": [],409 "name": "description",410 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],411 "stateMutability": "view",412 "type": "function"413 },414 {415 "inputs": [416 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }417 ],418 "name": "getApproved",419 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],420 "stateMutability": "view",421 "type": "function"422 },423 {424 "inputs": [],425 "name": "hasCollectionPendingSponsor",426 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],427 "stateMutability": "view",428 "type": "function"429 },430 {431 "inputs": [432 { "internalType": "address", "name": "owner", "type": "address" },433 { "internalType": "address", "name": "operator", "type": "address" }434 ],435 "name": "isApprovedForAll",436 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],437 "stateMutability": "view",438 "type": "function"439 },440 {441 "inputs": [442 {443 "components": [444 { "internalType": "address", "name": "eth", "type": "address" },445 { "internalType": "uint256", "name": "sub", "type": "uint256" }446 ],447 "internalType": "struct CrossAddress",448 "name": "user",449 "type": "tuple"450 }451 ],452 "name": "isOwnerOrAdminCross",453 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],454 "stateMutability": "view",455 "type": "function"456 },457 {458 "inputs": [{ "internalType": "address", "name": "to", "type": "address" }],459 "name": "mint",460 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],461 "stateMutability": "nonpayable",462 "type": "function"463 },464 {465 "inputs": [466 {467 "components": [468 { "internalType": "address", "name": "eth", "type": "address" },469 { "internalType": "uint256", "name": "sub", "type": "uint256" }470 ],471 "internalType": "struct CrossAddress",472 "name": "to",473 "type": "tuple"474 },475 {476 "components": [477 { "internalType": "string", "name": "key", "type": "string" },478 { "internalType": "bytes", "name": "value", "type": "bytes" }479 ],480 "internalType": "struct Property[]",481 "name": "properties",482 "type": "tuple[]"483 }484 ],485 "name": "mintCross",486 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],487 "stateMutability": "nonpayable",488 "type": "function"489 },490 {491 "inputs": [492 { "internalType": "address", "name": "to", "type": "address" },493 { "internalType": "string", "name": "tokenUri", "type": "string" }494 ],495 "name": "mintWithTokenURI",496 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],497 "stateMutability": "nonpayable",498 "type": "function"499 },500 {501 "inputs": [],502 "name": "name",503 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],504 "stateMutability": "view",505 "type": "function"506 },507 {508 "inputs": [],509 "name": "nextTokenId",510 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],511 "stateMutability": "view",512 "type": "function"513 },514 {515 "inputs": [516 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }517 ],518 "name": "ownerOf",519 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],520 "stateMutability": "view",521 "type": "function"522 },523 {524 "inputs": [525 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },526 { "internalType": "string[]", "name": "keys", "type": "string[]" }527 ],528 "name": "properties",529 "outputs": [530 {531 "components": [532 { "internalType": "string", "name": "key", "type": "string" },533 { "internalType": "bytes", "name": "value", "type": "bytes" }534 ],535 "internalType": "struct Property[]",536 "name": "",537 "type": "tuple[]"538 }539 ],540 "stateMutability": "view",541 "type": "function"542 },543 {544 "inputs": [545 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },546 { "internalType": "string", "name": "key", "type": "string" }547 ],548 "name": "property",549 "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],550 "stateMutability": "view",551 "type": "function"552 },553 {554 "inputs": [555 {556 "components": [557 { "internalType": "address", "name": "eth", "type": "address" },558 { "internalType": "uint256", "name": "sub", "type": "uint256" }559 ],560 "internalType": "struct CrossAddress",561 "name": "admin",562 "type": "tuple"563 }564 ],565 "name": "removeCollectionAdminCross",566 "outputs": [],567 "stateMutability": "nonpayable",568 "type": "function"569 },570 {571 "inputs": [],572 "name": "removeCollectionSponsor",573 "outputs": [],574 "stateMutability": "nonpayable",575 "type": "function"576 },577 {578 "inputs": [579 {580 "components": [581 { "internalType": "address", "name": "eth", "type": "address" },582 { "internalType": "uint256", "name": "sub", "type": "uint256" }583 ],584 "internalType": "struct CrossAddress",585 "name": "user",586 "type": "tuple"587 }588 ],589 "name": "removeFromCollectionAllowListCross",590 "outputs": [],591 "stateMutability": "nonpayable",592 "type": "function"593 },594 {595 "inputs": [596 { "internalType": "address", "name": "from", "type": "address" },597 { "internalType": "address", "name": "to", "type": "address" },598 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }599 ],600 "name": "safeTransferFrom",601 "outputs": [],602 "stateMutability": "nonpayable",603 "type": "function"604 },605 {606 "inputs": [607 { "internalType": "address", "name": "from", "type": "address" },608 { "internalType": "address", "name": "to", "type": "address" },609 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },610 { "internalType": "bytes", "name": "data", "type": "bytes" }611 ],612 "name": "safeTransferFrom",613 "outputs": [],614 "stateMutability": "nonpayable",615 "type": "function"616 },617 {618 "inputs": [619 { "internalType": "address", "name": "operator", "type": "address" },620 { "internalType": "bool", "name": "approved", "type": "bool" }621 ],622 "name": "setApprovalForAll",623 "outputs": [],624 "stateMutability": "nonpayable",625 "type": "function"626 },627 {628 "inputs": [629 { "internalType": "enum AccessMode", "name": "mode", "type": "uint8" }630 ],631 "name": "setCollectionAccess",632 "outputs": [],633 "stateMutability": "nonpayable",634 "type": "function"635 },636 {637 "inputs": [638 {639 "components": [640 {641 "internalType": "enum CollectionLimitField",642 "name": "field",643 "type": "uint8"644 },645 {646 "components": [647 { "internalType": "bool", "name": "status", "type": "bool" },648 { "internalType": "uint256", "name": "value", "type": "uint256" }649 ],650 "internalType": "struct OptionUint256",651 "name": "value",652 "type": "tuple"653 }654 ],655 "internalType": "struct CollectionLimit",656 "name": "limit",657 "type": "tuple"658 }659 ],660 "name": "setCollectionLimit",661 "outputs": [],662 "stateMutability": "nonpayable",663 "type": "function"664 },665 {666 "inputs": [{ "internalType": "bool", "name": "mode", "type": "bool" }],667 "name": "setCollectionMintMode",668 "outputs": [],669 "stateMutability": "nonpayable",670 "type": "function"671 },672 {673 "inputs": [{ "internalType": "bool", "name": "enable", "type": "bool" }],674 "name": "setCollectionNesting",675 "outputs": [],676 "stateMutability": "nonpayable",677 "type": "function"678 },679 {680 "inputs": [681 { "internalType": "bool", "name": "enable", "type": "bool" },682 {683 "internalType": "address[]",684 "name": "collections",685 "type": "address[]"686 }687 ],688 "name": "setCollectionNesting",689 "outputs": [],690 "stateMutability": "nonpayable",691 "type": "function"692 },693 {694 "inputs": [695 {696 "components": [697 { "internalType": "string", "name": "key", "type": "string" },698 { "internalType": "bytes", "name": "value", "type": "bytes" }699 ],700 "internalType": "struct Property[]",701 "name": "properties",702 "type": "tuple[]"703 }704 ],705 "name": "setCollectionProperties",706 "outputs": [],707 "stateMutability": "nonpayable",708 "type": "function"709 },710 {711 "inputs": [712 {713 "components": [714 { "internalType": "address", "name": "eth", "type": "address" },715 { "internalType": "uint256", "name": "sub", "type": "uint256" }716 ],717 "internalType": "struct CrossAddress",718 "name": "sponsor",719 "type": "tuple"720 }721 ],722 "name": "setCollectionSponsorCross",723 "outputs": [],724 "stateMutability": "nonpayable",725 "type": "function"726 },727 {728 "inputs": [729 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },730 {731 "components": [732 { "internalType": "string", "name": "key", "type": "string" },733 { "internalType": "bytes", "name": "value", "type": "bytes" }734 ],735 "internalType": "struct Property[]",736 "name": "properties",737 "type": "tuple[]"738 }739 ],740 "name": "setProperties",741 "outputs": [],742 "stateMutability": "nonpayable",743 "type": "function"744 },745 {746 "inputs": [747 {748 "components": [749 { "internalType": "string", "name": "key", "type": "string" },750 {751 "components": [752 {753 "internalType": "enum TokenPermissionField",754 "name": "code",755 "type": "uint8"756 },757 { "internalType": "bool", "name": "value", "type": "bool" }758 ],759 "internalType": "struct PropertyPermission[]",760 "name": "permissions",761 "type": "tuple[]"762 }763 ],764 "internalType": "struct TokenPropertyPermission[]",765 "name": "permissions",766 "type": "tuple[]"767 }768 ],769 "name": "setTokenPropertyPermissions",770 "outputs": [],771 "stateMutability": "nonpayable",772 "type": "function"773 },774 {775 "inputs": [776 { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }777 ],778 "name": "supportsInterface",779 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],780 "stateMutability": "view",781 "type": "function"782 },783 {784 "inputs": [],785 "name": "symbol",786 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],787 "stateMutability": "view",788 "type": "function"789 },790 {791 "inputs": [792 { "internalType": "uint256", "name": "index", "type": "uint256" }793 ],794 "name": "tokenByIndex",795 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],796 "stateMutability": "view",797 "type": "function"798 },799 {800 "inputs": [801 { "internalType": "uint256", "name": "token", "type": "uint256" }802 ],803 "name": "tokenContractAddress",804 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],805 "stateMutability": "view",806 "type": "function"807 },808 {809 "inputs": [810 { "internalType": "address", "name": "owner", "type": "address" },811 { "internalType": "uint256", "name": "index", "type": "uint256" }812 ],813 "name": "tokenOfOwnerByIndex",814 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],815 "stateMutability": "view",816 "type": "function"817 },818 {819 "inputs": [],820 "name": "tokenPropertyPermissions",821 "outputs": [822 {823 "components": [824 { "internalType": "string", "name": "key", "type": "string" },825 {826 "components": [827 {828 "internalType": "enum TokenPermissionField",829 "name": "code",830 "type": "uint8"831 },832 { "internalType": "bool", "name": "value", "type": "bool" }833 ],834 "internalType": "struct PropertyPermission[]",835 "name": "permissions",836 "type": "tuple[]"837 }838 ],839 "internalType": "struct TokenPropertyPermission[]",840 "name": "",841 "type": "tuple[]"842 }843 ],844 "stateMutability": "view",845 "type": "function"846 },847 {848 "inputs": [849 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }850 ],851 "name": "tokenURI",852 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],853 "stateMutability": "view",854 "type": "function"855 },856 {857 "inputs": [],858 "name": "totalSupply",859 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],860 "stateMutability": "view",861 "type": "function"862 },863 {864 "inputs": [865 { "internalType": "address", "name": "to", "type": "address" },866 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }867 ],868 "name": "transfer",869 "outputs": [],870 "stateMutability": "nonpayable",871 "type": "function"872 },873 {874 "inputs": [875 {876 "components": [877 { "internalType": "address", "name": "eth", "type": "address" },878 { "internalType": "uint256", "name": "sub", "type": "uint256" }879 ],880 "internalType": "struct CrossAddress",881 "name": "to",882 "type": "tuple"883 },884 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }885 ],886 "name": "transferCross",887 "outputs": [],888 "stateMutability": "nonpayable",889 "type": "function"890 },891 {892 "inputs": [893 { "internalType": "address", "name": "from", "type": "address" },894 { "internalType": "address", "name": "to", "type": "address" },895 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }896 ],897 "name": "transferFrom",898 "outputs": [],899 "stateMutability": "nonpayable",900 "type": "function"901 },902 {903 "inputs": [904 {905 "components": [906 { "internalType": "address", "name": "eth", "type": "address" },907 { "internalType": "uint256", "name": "sub", "type": "uint256" }908 ],909 "internalType": "struct CrossAddress",910 "name": "from",911 "type": "tuple"912 },913 {914 "components": [915 { "internalType": "address", "name": "eth", "type": "address" },916 { "internalType": "uint256", "name": "sub", "type": "uint256" }917 ],918 "internalType": "struct CrossAddress",919 "name": "to",920 "type": "tuple"921 },922 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }923 ],924 "name": "transferFromCross",925 "outputs": [],926 "stateMutability": "nonpayable",927 "type": "function"928 },929 {930 "inputs": [],931 "name": "uniqueCollectionType",932 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],933 "stateMutability": "view",934 "type": "function"935 }936]1[2 {3 "anonymous": false,4 "inputs": [5 {6 "indexed": true,7 "internalType": "address",8 "name": "owner",9 "type": "address"10 },11 {12 "indexed": true,13 "internalType": "address",14 "name": "approved",15 "type": "address"16 },17 {18 "indexed": true,19 "internalType": "uint256",20 "name": "tokenId",21 "type": "uint256"22 }23 ],24 "name": "Approval",25 "type": "event"26 },27 {28 "anonymous": false,29 "inputs": [30 {31 "indexed": true,32 "internalType": "address",33 "name": "owner",34 "type": "address"35 },36 {37 "indexed": true,38 "internalType": "address",39 "name": "operator",40 "type": "address"41 },42 {43 "indexed": false,44 "internalType": "bool",45 "name": "approved",46 "type": "bool"47 }48 ],49 "name": "ApprovalForAll",50 "type": "event"51 },52 {53 "anonymous": false,54 "inputs": [55 {56 "indexed": true,57 "internalType": "uint256",58 "name": "tokenId",59 "type": "uint256"60 }61 ],62 "name": "TokenChanged",63 "type": "event"64 },65 {66 "anonymous": false,67 "inputs": [68 {69 "indexed": true,70 "internalType": "address",71 "name": "from",72 "type": "address"73 },74 {75 "indexed": true,76 "internalType": "address",77 "name": "to",78 "type": "address"79 },80 {81 "indexed": true,82 "internalType": "uint256",83 "name": "tokenId",84 "type": "uint256"85 }86 ],87 "name": "Transfer",88 "type": "event"89 },90 {91 "inputs": [92 {93 "components": [94 { "internalType": "address", "name": "eth", "type": "address" },95 { "internalType": "uint256", "name": "sub", "type": "uint256" }96 ],97 "internalType": "struct CrossAddress",98 "name": "newAdmin",99 "type": "tuple"100 }101 ],102 "name": "addCollectionAdminCross",103 "outputs": [],104 "stateMutability": "nonpayable",105 "type": "function"106 },107 {108 "inputs": [109 {110 "components": [111 { "internalType": "address", "name": "eth", "type": "address" },112 { "internalType": "uint256", "name": "sub", "type": "uint256" }113 ],114 "internalType": "struct CrossAddress",115 "name": "user",116 "type": "tuple"117 }118 ],119 "name": "addToCollectionAllowListCross",120 "outputs": [],121 "stateMutability": "nonpayable",122 "type": "function"123 },124 {125 "inputs": [126 {127 "components": [128 { "internalType": "address", "name": "eth", "type": "address" },129 { "internalType": "uint256", "name": "sub", "type": "uint256" }130 ],131 "internalType": "struct CrossAddress",132 "name": "user",133 "type": "tuple"134 }135 ],136 "name": "allowlistedCross",137 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],138 "stateMutability": "view",139 "type": "function"140 },141 {142 "inputs": [143 { "internalType": "address", "name": "approved", "type": "address" },144 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }145 ],146 "name": "approve",147 "outputs": [],148 "stateMutability": "nonpayable",149 "type": "function"150 },151 {152 "inputs": [153 { "internalType": "address", "name": "owner", "type": "address" }154 ],155 "name": "balanceOf",156 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],157 "stateMutability": "view",158 "type": "function"159 },160 {161 "inputs": [162 {163 "components": [164 { "internalType": "address", "name": "eth", "type": "address" },165 { "internalType": "uint256", "name": "sub", "type": "uint256" }166 ],167 "internalType": "struct CrossAddress",168 "name": "owner",169 "type": "tuple"170 }171 ],172 "name": "balanceOfCross",173 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],174 "stateMutability": "view",175 "type": "function"176 },177 {178 "inputs": [179 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }180 ],181 "name": "burn",182 "outputs": [],183 "stateMutability": "nonpayable",184 "type": "function"185 },186 {187 "inputs": [188 {189 "components": [190 { "internalType": "address", "name": "eth", "type": "address" },191 { "internalType": "uint256", "name": "sub", "type": "uint256" }192 ],193 "internalType": "struct CrossAddress",194 "name": "from",195 "type": "tuple"196 },197 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }198 ],199 "name": "burnFromCross",200 "outputs": [],201 "stateMutability": "nonpayable",202 "type": "function"203 },204 {205 "inputs": [206 {207 "components": [208 { "internalType": "address", "name": "eth", "type": "address" },209 { "internalType": "uint256", "name": "sub", "type": "uint256" }210 ],211 "internalType": "struct CrossAddress",212 "name": "newOwner",213 "type": "tuple"214 }215 ],216 "name": "changeCollectionOwnerCross",217 "outputs": [],218 "stateMutability": "nonpayable",219 "type": "function"220 },221 {222 "inputs": [],223 "name": "collectionAdmins",224 "outputs": [225 {226 "components": [227 { "internalType": "address", "name": "eth", "type": "address" },228 { "internalType": "uint256", "name": "sub", "type": "uint256" }229 ],230 "internalType": "struct CrossAddress[]",231 "name": "",232 "type": "tuple[]"233 }234 ],235 "stateMutability": "view",236 "type": "function"237 },238 {239 "inputs": [],240 "name": "collectionHelperAddress",241 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],242 "stateMutability": "view",243 "type": "function"244 },245 {246 "inputs": [],247 "name": "collectionLimits",248 "outputs": [249 {250 "components": [251 {252 "internalType": "enum CollectionLimitField",253 "name": "field",254 "type": "uint8"255 },256 {257 "components": [258 { "internalType": "bool", "name": "status", "type": "bool" },259 { "internalType": "uint256", "name": "value", "type": "uint256" }260 ],261 "internalType": "struct OptionUint256",262 "name": "value",263 "type": "tuple"264 }265 ],266 "internalType": "struct CollectionLimit[]",267 "name": "",268 "type": "tuple[]"269 }270 ],271 "stateMutability": "view",272 "type": "function"273 },274 {275 "inputs": [],276 "name": "collectionNestingPermissions",277 "outputs": [278 {279 "components": [280 {281 "internalType": "enum CollectionPermissionField",282 "name": "field",283 "type": "uint8"284 },285 { "internalType": "bool", "name": "value", "type": "bool" }286 ],287 "internalType": "struct CollectionNestingPermission[]",288 "name": "",289 "type": "tuple[]"290 }291 ],292 "stateMutability": "view",293 "type": "function"294 },295 {296 "inputs": [],297 "name": "collectionNestingRestrictedCollectionIds",298 "outputs": [299 {300 "components": [301 { "internalType": "bool", "name": "token_owner", "type": "bool" },302 { "internalType": "uint256[]", "name": "ids", "type": "uint256[]" }303 ],304 "internalType": "struct CollectionNesting",305 "name": "",306 "type": "tuple"307 }308 ],309 "stateMutability": "view",310 "type": "function"311 },312 {313 "inputs": [],314 "name": "collectionOwner",315 "outputs": [316 {317 "components": [318 { "internalType": "address", "name": "eth", "type": "address" },319 { "internalType": "uint256", "name": "sub", "type": "uint256" }320 ],321 "internalType": "struct CrossAddress",322 "name": "",323 "type": "tuple"324 }325 ],326 "stateMutability": "view",327 "type": "function"328 },329 {330 "inputs": [331 { "internalType": "string[]", "name": "keys", "type": "string[]" }332 ],333 "name": "collectionProperties",334 "outputs": [335 {336 "components": [337 { "internalType": "string", "name": "key", "type": "string" },338 { "internalType": "bytes", "name": "value", "type": "bytes" }339 ],340 "internalType": "struct Property[]",341 "name": "",342 "type": "tuple[]"343 }344 ],345 "stateMutability": "view",346 "type": "function"347 },348 {349 "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],350 "name": "collectionProperty",351 "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],352 "stateMutability": "view",353 "type": "function"354 },355 {356 "inputs": [],357 "name": "collectionSponsor",358 "outputs": [359 {360 "components": [361 { "internalType": "address", "name": "eth", "type": "address" },362 { "internalType": "uint256", "name": "sub", "type": "uint256" }363 ],364 "internalType": "struct CrossAddress",365 "name": "",366 "type": "tuple"367 }368 ],369 "stateMutability": "view",370 "type": "function"371 },372 {373 "inputs": [],374 "name": "confirmCollectionSponsorship",375 "outputs": [],376 "stateMutability": "nonpayable",377 "type": "function"378 },379 {380 "inputs": [],381 "name": "contractAddress",382 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],383 "stateMutability": "view",384 "type": "function"385 },386 {387 "inputs": [388 { "internalType": "string[]", "name": "keys", "type": "string[]" }389 ],390 "name": "deleteCollectionProperties",391 "outputs": [],392 "stateMutability": "nonpayable",393 "type": "function"394 },395 {396 "inputs": [397 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },398 { "internalType": "string[]", "name": "keys", "type": "string[]" }399 ],400 "name": "deleteProperties",401 "outputs": [],402 "stateMutability": "nonpayable",403 "type": "function"404 },405 {406 "inputs": [],407 "name": "description",408 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],409 "stateMutability": "view",410 "type": "function"411 },412 {413 "inputs": [414 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }415 ],416 "name": "getApproved",417 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],418 "stateMutability": "view",419 "type": "function"420 },421 {422 "inputs": [],423 "name": "hasCollectionPendingSponsor",424 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],425 "stateMutability": "view",426 "type": "function"427 },428 {429 "inputs": [430 { "internalType": "address", "name": "owner", "type": "address" },431 { "internalType": "address", "name": "operator", "type": "address" }432 ],433 "name": "isApprovedForAll",434 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],435 "stateMutability": "view",436 "type": "function"437 },438 {439 "inputs": [440 {441 "components": [442 { "internalType": "address", "name": "eth", "type": "address" },443 { "internalType": "uint256", "name": "sub", "type": "uint256" }444 ],445 "internalType": "struct CrossAddress",446 "name": "user",447 "type": "tuple"448 }449 ],450 "name": "isOwnerOrAdminCross",451 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],452 "stateMutability": "view",453 "type": "function"454 },455 {456 "inputs": [{ "internalType": "address", "name": "to", "type": "address" }],457 "name": "mint",458 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],459 "stateMutability": "nonpayable",460 "type": "function"461 },462 {463 "inputs": [464 {465 "components": [466 { "internalType": "address", "name": "eth", "type": "address" },467 { "internalType": "uint256", "name": "sub", "type": "uint256" }468 ],469 "internalType": "struct CrossAddress",470 "name": "to",471 "type": "tuple"472 },473 {474 "components": [475 { "internalType": "string", "name": "key", "type": "string" },476 { "internalType": "bytes", "name": "value", "type": "bytes" }477 ],478 "internalType": "struct Property[]",479 "name": "properties",480 "type": "tuple[]"481 }482 ],483 "name": "mintCross",484 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],485 "stateMutability": "nonpayable",486 "type": "function"487 },488 {489 "inputs": [490 { "internalType": "address", "name": "to", "type": "address" },491 { "internalType": "string", "name": "tokenUri", "type": "string" }492 ],493 "name": "mintWithTokenURI",494 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],495 "stateMutability": "nonpayable",496 "type": "function"497 },498 {499 "inputs": [],500 "name": "name",501 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],502 "stateMutability": "view",503 "type": "function"504 },505 {506 "inputs": [],507 "name": "nextTokenId",508 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],509 "stateMutability": "view",510 "type": "function"511 },512 {513 "inputs": [514 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }515 ],516 "name": "ownerOf",517 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],518 "stateMutability": "view",519 "type": "function"520 },521 {522 "inputs": [523 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }524 ],525 "name": "ownerOfCross",526 "outputs": [527 {528 "components": [529 { "internalType": "address", "name": "eth", "type": "address" },530 { "internalType": "uint256", "name": "sub", "type": "uint256" }531 ],532 "internalType": "struct CrossAddress",533 "name": "",534 "type": "tuple"535 }536 ],537 "stateMutability": "view",538 "type": "function"539 },540 {541 "inputs": [542 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },543 { "internalType": "string[]", "name": "keys", "type": "string[]" }544 ],545 "name": "properties",546 "outputs": [547 {548 "components": [549 { "internalType": "string", "name": "key", "type": "string" },550 { "internalType": "bytes", "name": "value", "type": "bytes" }551 ],552 "internalType": "struct Property[]",553 "name": "",554 "type": "tuple[]"555 }556 ],557 "stateMutability": "view",558 "type": "function"559 },560 {561 "inputs": [562 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },563 { "internalType": "string", "name": "key", "type": "string" }564 ],565 "name": "property",566 "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],567 "stateMutability": "view",568 "type": "function"569 },570 {571 "inputs": [572 {573 "components": [574 { "internalType": "address", "name": "eth", "type": "address" },575 { "internalType": "uint256", "name": "sub", "type": "uint256" }576 ],577 "internalType": "struct CrossAddress",578 "name": "admin",579 "type": "tuple"580 }581 ],582 "name": "removeCollectionAdminCross",583 "outputs": [],584 "stateMutability": "nonpayable",585 "type": "function"586 },587 {588 "inputs": [],589 "name": "removeCollectionSponsor",590 "outputs": [],591 "stateMutability": "nonpayable",592 "type": "function"593 },594 {595 "inputs": [596 {597 "components": [598 { "internalType": "address", "name": "eth", "type": "address" },599 { "internalType": "uint256", "name": "sub", "type": "uint256" }600 ],601 "internalType": "struct CrossAddress",602 "name": "user",603 "type": "tuple"604 }605 ],606 "name": "removeFromCollectionAllowListCross",607 "outputs": [],608 "stateMutability": "nonpayable",609 "type": "function"610 },611 {612 "inputs": [613 { "internalType": "address", "name": "from", "type": "address" },614 { "internalType": "address", "name": "to", "type": "address" },615 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }616 ],617 "name": "safeTransferFrom",618 "outputs": [],619 "stateMutability": "nonpayable",620 "type": "function"621 },622 {623 "inputs": [624 { "internalType": "address", "name": "from", "type": "address" },625 { "internalType": "address", "name": "to", "type": "address" },626 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },627 { "internalType": "bytes", "name": "data", "type": "bytes" }628 ],629 "name": "safeTransferFrom",630 "outputs": [],631 "stateMutability": "nonpayable",632 "type": "function"633 },634 {635 "inputs": [636 { "internalType": "address", "name": "operator", "type": "address" },637 { "internalType": "bool", "name": "approved", "type": "bool" }638 ],639 "name": "setApprovalForAll",640 "outputs": [],641 "stateMutability": "nonpayable",642 "type": "function"643 },644 {645 "inputs": [646 { "internalType": "enum AccessMode", "name": "mode", "type": "uint8" }647 ],648 "name": "setCollectionAccess",649 "outputs": [],650 "stateMutability": "nonpayable",651 "type": "function"652 },653 {654 "inputs": [655 {656 "components": [657 {658 "internalType": "enum CollectionLimitField",659 "name": "field",660 "type": "uint8"661 },662 {663 "components": [664 { "internalType": "bool", "name": "status", "type": "bool" },665 { "internalType": "uint256", "name": "value", "type": "uint256" }666 ],667 "internalType": "struct OptionUint256",668 "name": "value",669 "type": "tuple"670 }671 ],672 "internalType": "struct CollectionLimit",673 "name": "limit",674 "type": "tuple"675 }676 ],677 "name": "setCollectionLimit",678 "outputs": [],679 "stateMutability": "nonpayable",680 "type": "function"681 },682 {683 "inputs": [{ "internalType": "bool", "name": "mode", "type": "bool" }],684 "name": "setCollectionMintMode",685 "outputs": [],686 "stateMutability": "nonpayable",687 "type": "function"688 },689 {690 "inputs": [{ "internalType": "bool", "name": "enable", "type": "bool" }],691 "name": "setCollectionNesting",692 "outputs": [],693 "stateMutability": "nonpayable",694 "type": "function"695 },696 {697 "inputs": [698 { "internalType": "bool", "name": "enable", "type": "bool" },699 {700 "internalType": "address[]",701 "name": "collections",702 "type": "address[]"703 }704 ],705 "name": "setCollectionNesting",706 "outputs": [],707 "stateMutability": "nonpayable",708 "type": "function"709 },710 {711 "inputs": [712 {713 "components": [714 { "internalType": "string", "name": "key", "type": "string" },715 { "internalType": "bytes", "name": "value", "type": "bytes" }716 ],717 "internalType": "struct Property[]",718 "name": "properties",719 "type": "tuple[]"720 }721 ],722 "name": "setCollectionProperties",723 "outputs": [],724 "stateMutability": "nonpayable",725 "type": "function"726 },727 {728 "inputs": [729 {730 "components": [731 { "internalType": "address", "name": "eth", "type": "address" },732 { "internalType": "uint256", "name": "sub", "type": "uint256" }733 ],734 "internalType": "struct CrossAddress",735 "name": "sponsor",736 "type": "tuple"737 }738 ],739 "name": "setCollectionSponsorCross",740 "outputs": [],741 "stateMutability": "nonpayable",742 "type": "function"743 },744 {745 "inputs": [746 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },747 {748 "components": [749 { "internalType": "string", "name": "key", "type": "string" },750 { "internalType": "bytes", "name": "value", "type": "bytes" }751 ],752 "internalType": "struct Property[]",753 "name": "properties",754 "type": "tuple[]"755 }756 ],757 "name": "setProperties",758 "outputs": [],759 "stateMutability": "nonpayable",760 "type": "function"761 },762 {763 "inputs": [764 {765 "components": [766 { "internalType": "string", "name": "key", "type": "string" },767 {768 "components": [769 {770 "internalType": "enum TokenPermissionField",771 "name": "code",772 "type": "uint8"773 },774 { "internalType": "bool", "name": "value", "type": "bool" }775 ],776 "internalType": "struct PropertyPermission[]",777 "name": "permissions",778 "type": "tuple[]"779 }780 ],781 "internalType": "struct TokenPropertyPermission[]",782 "name": "permissions",783 "type": "tuple[]"784 }785 ],786 "name": "setTokenPropertyPermissions",787 "outputs": [],788 "stateMutability": "nonpayable",789 "type": "function"790 },791 {792 "inputs": [793 { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }794 ],795 "name": "supportsInterface",796 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],797 "stateMutability": "view",798 "type": "function"799 },800 {801 "inputs": [],802 "name": "symbol",803 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],804 "stateMutability": "view",805 "type": "function"806 },807 {808 "inputs": [809 { "internalType": "uint256", "name": "index", "type": "uint256" }810 ],811 "name": "tokenByIndex",812 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],813 "stateMutability": "view",814 "type": "function"815 },816 {817 "inputs": [818 { "internalType": "uint256", "name": "token", "type": "uint256" }819 ],820 "name": "tokenContractAddress",821 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],822 "stateMutability": "view",823 "type": "function"824 },825 {826 "inputs": [827 { "internalType": "address", "name": "owner", "type": "address" },828 { "internalType": "uint256", "name": "index", "type": "uint256" }829 ],830 "name": "tokenOfOwnerByIndex",831 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],832 "stateMutability": "view",833 "type": "function"834 },835 {836 "inputs": [],837 "name": "tokenPropertyPermissions",838 "outputs": [839 {840 "components": [841 { "internalType": "string", "name": "key", "type": "string" },842 {843 "components": [844 {845 "internalType": "enum TokenPermissionField",846 "name": "code",847 "type": "uint8"848 },849 { "internalType": "bool", "name": "value", "type": "bool" }850 ],851 "internalType": "struct PropertyPermission[]",852 "name": "permissions",853 "type": "tuple[]"854 }855 ],856 "internalType": "struct TokenPropertyPermission[]",857 "name": "",858 "type": "tuple[]"859 }860 ],861 "stateMutability": "view",862 "type": "function"863 },864 {865 "inputs": [866 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }867 ],868 "name": "tokenURI",869 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],870 "stateMutability": "view",871 "type": "function"872 },873 {874 "inputs": [],875 "name": "totalSupply",876 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],877 "stateMutability": "view",878 "type": "function"879 },880 {881 "inputs": [882 { "internalType": "address", "name": "to", "type": "address" },883 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }884 ],885 "name": "transfer",886 "outputs": [],887 "stateMutability": "nonpayable",888 "type": "function"889 },890 {891 "inputs": [892 {893 "components": [894 { "internalType": "address", "name": "eth", "type": "address" },895 { "internalType": "uint256", "name": "sub", "type": "uint256" }896 ],897 "internalType": "struct CrossAddress",898 "name": "to",899 "type": "tuple"900 },901 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }902 ],903 "name": "transferCross",904 "outputs": [],905 "stateMutability": "nonpayable",906 "type": "function"907 },908 {909 "inputs": [910 { "internalType": "address", "name": "from", "type": "address" },911 { "internalType": "address", "name": "to", "type": "address" },912 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }913 ],914 "name": "transferFrom",915 "outputs": [],916 "stateMutability": "nonpayable",917 "type": "function"918 },919 {920 "inputs": [921 {922 "components": [923 { "internalType": "address", "name": "eth", "type": "address" },924 { "internalType": "uint256", "name": "sub", "type": "uint256" }925 ],926 "internalType": "struct CrossAddress",927 "name": "from",928 "type": "tuple"929 },930 {931 "components": [932 { "internalType": "address", "name": "eth", "type": "address" },933 { "internalType": "uint256", "name": "sub", "type": "uint256" }934 ],935 "internalType": "struct CrossAddress",936 "name": "to",937 "type": "tuple"938 },939 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }940 ],941 "name": "transferFromCross",942 "outputs": [],943 "stateMutability": "nonpayable",944 "type": "function"945 },946 {947 "inputs": [],948 "name": "uniqueCollectionType",949 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],950 "stateMutability": "view",951 "type": "function"952 }953]tests/src/eth/abi/reFungibleToken.jsondiffbeforeafterboth--- a/tests/src/eth/abi/reFungibleToken.json
+++ b/tests/src/eth/abi/reFungibleToken.json
@@ -130,6 +130,23 @@
{ "internalType": "uint256", "name": "sub", "type": "uint256" }
],
"internalType": "struct CrossAddress",
+ "name": "owner",
+ "type": "tuple"
+ }
+ ],
+ "name": "balanceOfCross",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "components": [
+ { "internalType": "address", "name": "eth", "type": "address" },
+ { "internalType": "uint256", "name": "sub", "type": "uint256" }
+ ],
+ "internalType": "struct CrossAddress",
"name": "from",
"type": "tuple"
},
tests/src/eth/api/UniqueFungible.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueFungible.sol
+++ b/tests/src/eth/api/UniqueFungible.sol
@@ -353,7 +353,7 @@
bytes value;
}
-/// @dev the ERC-165 identifier for this interface is 0x85d7dea6
+/// @dev the ERC-165 identifier for this interface is 0x69d14d3e
interface ERC20UniqueExtensions is Dummy, ERC165 {
/// @dev Function to check the amount of tokens that an owner allowed to a spender.
/// @param owner crossAddress The address which owns the funds.
@@ -416,6 +416,13 @@
/// @dev EVM selector for this function is: 0x1896cce6,
/// or in textual repr: collectionHelperAddress()
function collectionHelperAddress() external view returns (address);
+
+ /// @notice Balance of account
+ /// @param owner An cross address for whom to query the balance
+ /// @return The number of fingibles owned by `owner`, possibly zero
+ /// @dev EVM selector for this function is: 0xec069398,
+ /// or in textual repr: balanceOfCross((address,uint256))
+ function balanceOfCross(CrossAddress memory owner) external view returns (uint256);
}
struct AmountForAddress {
tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueNFT.sol
+++ b/tests/src/eth/api/UniqueNFT.sol
@@ -533,7 +533,7 @@
}
/// @title Unique extensions for ERC721.
-/// @dev the ERC-165 identifier for this interface is 0x16de3152
+/// @dev the ERC-165 identifier for this interface is 0x307b061a
interface ERC721UniqueExtensions is Dummy, ERC165 {
/// @notice A descriptive name for a collection of NFTs in this contract
/// @dev EVM selector for this function is: 0x06fdde03,
@@ -550,12 +550,26 @@
/// or in textual repr: description()
function description() external view returns (string memory);
+ // /// Returns the owner (in cross format) of the token.
+ // ///
+ // /// @param tokenId Id for the token.
+ // /// @dev EVM selector for this function is: 0x2b29dace,
+ // /// or in textual repr: crossOwnerOf(uint256)
+ // function crossOwnerOf(uint256 tokenId) external view returns (CrossAddress memory);
+
/// Returns the owner (in cross format) of the token.
///
/// @param tokenId Id for the token.
- /// @dev EVM selector for this function is: 0x2b29dace,
- /// or in textual repr: crossOwnerOf(uint256)
- function crossOwnerOf(uint256 tokenId) external view returns (CrossAddress memory);
+ /// @dev EVM selector for this function is: 0xcaa3a4d0,
+ /// or in textual repr: ownerOfCross(uint256)
+ function ownerOfCross(uint256 tokenId) external view returns (CrossAddress memory);
+
+ /// @notice Count all NFTs assigned to an owner
+ /// @param owner An cross address for whom to query the balance
+ /// @return The number of NFTs owned by `owner`, possibly zero
+ /// @dev EVM selector for this function is: 0xec069398,
+ /// or in textual repr: balanceOfCross((address,uint256))
+ function balanceOfCross(CrossAddress memory owner) external view returns (uint256);
/// Returns the token properties.
///
tests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueRefungible.sol
+++ b/tests/src/eth/api/UniqueRefungible.sol
@@ -533,7 +533,7 @@
}
/// @title Unique extensions for ERC721.
-/// @dev the ERC-165 identifier for this interface is 0xb365c124
+/// @dev the ERC-165 identifier for this interface is 0x95c0f66c
interface ERC721UniqueExtensions is Dummy, ERC165 {
/// @notice A descriptive name for a collection of NFTs in this contract
/// @dev EVM selector for this function is: 0x06fdde03,
@@ -550,12 +550,26 @@
/// or in textual repr: description()
function description() external view returns (string memory);
+ // /// Returns the owner (in cross format) of the token.
+ // ///
+ // /// @param tokenId Id for the token.
+ // /// @dev EVM selector for this function is: 0x2b29dace,
+ // /// or in textual repr: crossOwnerOf(uint256)
+ // function crossOwnerOf(uint256 tokenId) external view returns (CrossAddress memory);
+
/// Returns the owner (in cross format) of the token.
///
/// @param tokenId Id for the token.
- /// @dev EVM selector for this function is: 0x2b29dace,
- /// or in textual repr: crossOwnerOf(uint256)
- function crossOwnerOf(uint256 tokenId) external view returns (CrossAddress memory);
+ /// @dev EVM selector for this function is: 0xcaa3a4d0,
+ /// or in textual repr: ownerOfCross(uint256)
+ function ownerOfCross(uint256 tokenId) external view returns (CrossAddress memory);
+
+ /// @notice Count all RFTs assigned to an owner
+ /// @param owner An cross address for whom to query the balance
+ /// @return The number of RFTs owned by `owner`, possibly zero
+ /// @dev EVM selector for this function is: 0xec069398,
+ /// or in textual repr: balanceOfCross((address,uint256))
+ function balanceOfCross(CrossAddress memory owner) external view returns (uint256);
/// Returns the token properties.
///
tests/src/eth/api/UniqueRefungibleToken.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueRefungibleToken.sol
+++ b/tests/src/eth/api/UniqueRefungibleToken.sol
@@ -23,7 +23,7 @@
function parentTokenId() external view returns (uint256);
}
-/// @dev the ERC-165 identifier for this interface is 0x01d536fc
+/// @dev the ERC-165 identifier for this interface is 0xedd3a564
interface ERC20UniqueExtensions is Dummy, ERC165 {
/// @dev Function to check the amount of tokens that an owner allowed to a spender.
/// @param owner crossAddress The address which owns the funds.
@@ -60,6 +60,13 @@
/// or in textual repr: approveCross((address,uint256),uint256)
function approveCross(CrossAddress memory spender, uint256 amount) external returns (bool);
+ /// @notice Balance of account
+ /// @param owner An cross address for whom to query the balance
+ /// @return The number of fingibles owned by `owner`, possibly zero
+ /// @dev EVM selector for this function is: 0xec069398,
+ /// or in textual repr: balanceOfCross((address,uint256))
+ function balanceOfCross(CrossAddress memory owner) external view returns (uint256);
+
/// @dev Function that changes total amount of the tokens.
/// Throws if `msg.sender` doesn't owns all of the tokens.
/// @param amount New total amount of the tokens.
tests/src/eth/fungible.test.tsdiffbeforeafterboth--- a/tests/src/eth/fungible.test.ts
+++ b/tests/src/eth/fungible.test.ts
@@ -427,6 +427,33 @@
const toBalanceAfter = await collection.getBalance({Ethereum: receiver});
expect(toBalanceAfter - toBalanceBefore).to.be.eq(51n);
});
+
+ itEth('Check balanceOfCross()', async ({helper}) => {
+ const collection = await helper.ft.mintCollection(alice, {});
+ const owner = await helper.ethCrossAccount.createAccountWithBalance(donor);
+ const other = await helper.ethCrossAccount.createAccountWithBalance(donor);
+ const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
+ const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'ft', owner.eth);
+
+ expect(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})).to.be.eq('0');
+ expect(await collectionEvm.methods.balanceOfCross(other).call({from: owner.eth})).to.be.eq('0');
+
+ await collection.mint(alice, 100n, {Ethereum: owner.eth});
+ expect(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})).to.be.eq('100');
+ expect(await collectionEvm.methods.balanceOfCross(other).call({from: owner.eth})).to.be.eq('0');
+
+ await collectionEvm.methods.transferCross(other, 50n).send({from: owner.eth});
+ expect(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})).to.be.eq('50');
+ expect(await collectionEvm.methods.balanceOfCross(other).call({from: owner.eth})).to.be.eq('50');
+
+ await collectionEvm.methods.transferCross(other, 50n).send({from: owner.eth});
+ expect(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})).to.be.eq('0');
+ expect(await collectionEvm.methods.balanceOfCross(other).call({from: owner.eth})).to.be.eq('100');
+
+ await collectionEvm.methods.transferCross(owner, 100n).send({from: other.eth});
+ expect(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})).to.be.eq('100');
+ expect(await collectionEvm.methods.balanceOfCross(other).call({from: owner.eth})).to.be.eq('0');
+ });
});
describe('Fungible: Fees', () => {
tests/src/eth/nonFungible.test.tsdiffbeforeafterboth--- a/tests/src/eth/nonFungible.test.ts
+++ b/tests/src/eth/nonFungible.test.ts
@@ -662,6 +662,38 @@
// Cannot transfer token if it does not exist:
await expect(collectionEvm.methods[testCase](receiver, 999999).send({from: sender})).to.be.rejected;
}));
+
+ itEth('Check balanceOfCross()', async ({helper}) => {
+ const collection = await helper.nft.mintCollection(minter, {});
+ const owner = await helper.ethCrossAccount.createAccountWithBalance(donor);
+ const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
+ const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner.eth);
+
+ expect(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})).to.be.eq('0');
+
+ for (let i = 1; i < 10; i++) {
+ await collection.mintToken(minter, {Ethereum: owner.eth});
+ expect(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})).to.be.eq(i.toString());
+ }
+ });
+
+ itEth('Check ownerOfCross()', async ({helper}) => {
+ const collection = await helper.nft.mintCollection(minter, {});
+ let owner = await helper.ethCrossAccount.createAccountWithBalance(donor);
+ const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
+ const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner.eth);
+ const {tokenId} = await collection.mintToken(minter, {Ethereum: owner.eth});
+
+ for (let i = 1n; i < 10n; i++) {
+ const ownerCross = await collectionEvm.methods.ownerOfCross(tokenId).call({from: owner.eth});
+ expect(ownerCross.eth).to.be.eq(owner.eth);
+ expect(ownerCross.sub).to.be.eq(owner.sub);
+
+ const newOwner = await helper.ethCrossAccount.createAccountWithBalance(donor);
+ await collectionEvm.methods.transferCross(newOwner, tokenId).send({from: owner.eth});
+ owner = newOwner;
+ }
+ });
});
describe('NFT: Fees', () => {
tests/src/eth/reFungible.test.tsdiffbeforeafterboth--- a/tests/src/eth/reFungible.test.ts
+++ b/tests/src/eth/reFungible.test.ts
@@ -584,6 +584,46 @@
expect(event.returnValues.to).to.equal('0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF');
expect(event.returnValues.tokenId).to.equal(tokenId.toString());
});
+
+ itEth('Check balanceOfCross()', async ({helper}) => {
+ const collection = await helper.rft.mintCollection(minter, {});
+ const owner = await helper.ethCrossAccount.createAccountWithBalance(donor);
+ const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
+ const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner.eth);
+
+ expect(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})).to.be.eq('0');
+
+ for (let i = 1n; i < 10n; i++) {
+ await collection.mintToken(minter, 100n, {Ethereum: owner.eth});
+ expect(await collectionEvm.methods.balanceOfCross(owner).call({from: owner.eth})).to.be.eq(i.toString());
+ }
+ });
+
+ itEth('Check ownerOfCross()', async ({helper}) => {
+ const collection = await helper.rft.mintCollection(minter, {});
+ let owner = await helper.ethCrossAccount.createAccountWithBalance(donor);
+ const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
+ const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner.eth);
+ const {tokenId} = await collection.mintToken(minter, 100n,{Ethereum: owner.eth});
+
+ for (let i = 1n; i < 10n; i++) {
+ const ownerCross = await collectionEvm.methods.ownerOfCross(tokenId).call({from: owner.eth});
+ expect(ownerCross.eth).to.be.eq(owner.eth);
+ expect(ownerCross.sub).to.be.eq(owner.sub);
+
+ const newOwner = await helper.ethCrossAccount.createAccountWithBalance(donor);
+ await collectionEvm.methods.transferCross(newOwner, tokenId).send({from: owner.eth});
+ owner = newOwner;
+ }
+
+ const tokenAddress = helper.ethAddress.fromTokenId(collection.collectionId, tokenId);
+ const tokenContract = await helper.ethNativeContract.rftToken(tokenAddress, owner.eth, true);
+ const newOwner = await helper.ethCrossAccount.createAccountWithBalance(donor);
+ await tokenContract.methods.transferCross(newOwner, 50).send({from: owner.eth});
+ const ownerCross = await collectionEvm.methods.ownerOfCross(tokenId).call({from: owner.eth});
+ expect(ownerCross.eth.toUpperCase()).to.be.eq('0XFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF');
+ expect(ownerCross.sub).to.be.eq('0');
+ });
});
describe('RFT: Fees', () => {
tests/src/eth/reFungibleToken.test.tsdiffbeforeafterboth--- a/tests/src/eth/reFungibleToken.test.ts
+++ b/tests/src/eth/reFungibleToken.test.ts
@@ -466,6 +466,35 @@
expect(await collection.getTokenBalance(tokenId, {Substrate: ownerSub.address})).to.be.equal(150n);
}
});
+
+ itEth('Check balanceOfCross()', async ({helper}) => {
+ const collection = await helper.rft.mintCollection(alice, {});
+ const owner = await helper.ethCrossAccount.createAccountWithBalance(donor);
+ const other = await helper.ethCrossAccount.createAccountWithBalance(donor);
+ const {tokenId} = await collection.mintToken(alice, 200n, {Ethereum: owner.eth});
+ const tokenAddress = helper.ethAddress.fromTokenId(collection.collectionId, tokenId);
+ const tokenContract = await helper.ethNativeContract.rftToken(tokenAddress, owner.eth);
+
+ expect(await tokenContract.methods.balanceOfCross(owner).call({from: owner.eth})).to.be.eq('200');
+ expect(await tokenContract.methods.balanceOfCross(other).call({from: owner.eth})).to.be.eq('0');
+
+ await tokenContract.methods.repartition(100n).send({from: owner.eth});
+ expect(await tokenContract.methods.balanceOfCross(owner).call({from: owner.eth})).to.be.eq('100');
+ expect(await tokenContract.methods.balanceOfCross(other).call({from: owner.eth})).to.be.eq('0');
+
+ await tokenContract.methods.transferCross(other, 50n).send({from: owner.eth});
+ expect(await tokenContract.methods.balanceOfCross(owner).call({from: owner.eth})).to.be.eq('50');
+ expect(await tokenContract.methods.balanceOfCross(other).call({from: owner.eth})).to.be.eq('50');
+
+ await tokenContract.methods.transferCross(other, 50n).send({from: owner.eth});
+ expect(await tokenContract.methods.balanceOfCross(owner).call({from: owner.eth})).to.be.eq('0');
+ expect(await tokenContract.methods.balanceOfCross(other).call({from: owner.eth})).to.be.eq('100');
+
+ await tokenContract.methods.repartition(1000n).send({from: other.eth});
+ await tokenContract.methods.transferCross(owner, 500n).send({from: other.eth});
+ expect(await tokenContract.methods.balanceOfCross(owner).call({from: owner.eth})).to.be.eq('500');
+ expect(await tokenContract.methods.balanceOfCross(other).call({from: owner.eth})).to.be.eq('500');
+ });
});
describe('Refungible: Fees', () => {
tests/src/eth/tokens/minting.test.tsdiffbeforeafterboth--- a/tests/src/eth/tokens/minting.test.ts
+++ b/tests/src/eth/tokens/minting.test.ts
@@ -63,7 +63,7 @@
const tokenId = event.returnValues.tokenId;
expect(tokenId).to.be.equal('1');
expect(await helper.collection.getLastTokenId(collection.collectionId)).to.eq(1);
- expect(await contract.methods.crossOwnerOf(tokenId).call()).to.be.like([receiver, '0']);
+ expect(await contract.methods.ownerOfCross(tokenId).call()).to.be.like([receiver, '0']);
}
});
});
@@ -97,7 +97,7 @@
const tokenId = event.returnValues.tokenId;
expect(tokenId).to.be.equal('1');
expect(await helper.collection.getLastTokenId(collectionId)).to.eq(1);
- expect(await collection.methods.crossOwnerOf(tokenId).call()).to.be.like([receiver, '0']);
+ expect(await collection.methods.ownerOfCross(tokenId).call()).to.be.like([receiver, '0']);
}
});
});
@@ -131,7 +131,7 @@
const tokenId = event.returnValues.tokenId;
expect(tokenId).to.be.equal('1');
expect(await helper.collection.getLastTokenId(collectionId)).to.eq(1);
- expect(await collection.methods.crossOwnerOf(tokenId).call()).to.be.like([receiver, '0']);
+ expect(await collection.methods.ownerOfCross(tokenId).call()).to.be.like([receiver, '0']);
}
});
});
@@ -157,7 +157,7 @@
expect(event.returnValues.to).to.be.equal(receiver);
expect(await contract.methods.tokenURI(tokenId).call()).to.be.equal('Test URI');
- expect(await contract.methods.crossOwnerOf(tokenId).call()).to.be.like([receiver, '0']);
+ expect(await contract.methods.ownerOfCross(tokenId).call()).to.be.like([receiver, '0']);
// TODO: this wont work right now, need release 919000 first
// await helper.methods.setOffchainSchema(collectionIdAddress, 'https://offchain-service.local/token-info/{id}').send();
// const tokenUri = await contract.methods.tokenURI(nextTokenId).call();