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

difftreelog

feat impl balance_of_cross

Trubnikov Sergey2023-04-21parent: #ec349b0.patch.diff
in: master

5 files changed

modifiedpallets/balances-adapter/src/erc.rsdiffbeforeafterboth
141where142where
142 T::AccountId: From<[u8; 32]>,143 T::AccountId: From<[u8; 32]>,
143{144{
145 fn balance_of_cross(&self, owner: CrossAddress) -> Result<U256> {
146 // self.consume_store_reads(1)?;
147 let owner = owner.into_sub_cross_account::<T>()?;
148 let balance = <T as Config>::Currency::free_balance(owner.as_sub());
149 Ok(balance.into())
150 }
151
144 // #[weight(<SelfWeightOf<T>>::transfer())]152 // #[weight(<SelfWeightOf<T>>::transfer())]
145 fn transfer_cross(&mut self, caller: Caller, to: CrossAddress, amount: U256) -> Result<bool> {153 fn transfer_cross(&mut self, caller: Caller, to: CrossAddress, amount: U256) -> Result<bool> {
modifiedpallets/balances-adapter/src/stubs/UniqueNativeFungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/balances-adapter/src/stubs/UniqueNativeFungible.soldiffbeforeafterboth
17 }17 }
18}18}
1919
20/// @dev the ERC-165 identifier for this interface is 0xff15c6f420/// @dev the ERC-165 identifier for this interface is 0x1313556c
21contract ERC20UniqueExtensions is Dummy, ERC165 {21contract ERC20UniqueExtensions is Dummy, ERC165 {
22 /// @dev EVM selector for this function is: 0xec069398,
23 /// or in textual repr: balanceOfCross((address,uint256))
24 function balanceOfCross(CrossAddress memory owner) public view returns (uint256) {
25 require(false, stub_error);
26 owner;
27 dummy;
28 return 0;
29 }
30
22 /// @dev EVM selector for this function is: 0x2ada85ff,31 /// @dev EVM selector for this function is: 0x2ada85ff,
23 /// or in textual repr: transferCross((address,uint256),uint256)32 /// or in textual repr: transferCross((address,uint256),uint256)
modifiedtests/src/eth/abi/nativeFungible.jsondiffbeforeafterboth
78 "stateMutability": "view",78 "stateMutability": "view",
79 "type": "function"79 "type": "function"
80 },80 },
81 {
82 "inputs": [
83 {
84 "components": [
85 { "internalType": "address", "name": "eth", "type": "address" },
86 { "internalType": "uint256", "name": "sub", "type": "uint256" }
87 ],
88 "internalType": "struct CrossAddress",
89 "name": "owner",
90 "type": "tuple"
91 }
92 ],
93 "name": "balanceOfCross",
94 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
95 "stateMutability": "view",
96 "type": "function"
97 },
81 {98 {
82 "inputs": [],99 "inputs": [],
83 "name": "decimals",100 "name": "decimals",
modifiedtests/src/eth/api/UniqueNativeFungible.soldiffbeforeafterboth
12 function supportsInterface(bytes4 interfaceID) external view returns (bool);12 function supportsInterface(bytes4 interfaceID) external view returns (bool);
13}13}
1414
15/// @dev the ERC-165 identifier for this interface is 0xff15c6f415/// @dev the ERC-165 identifier for this interface is 0x1313556c
16interface ERC20UniqueExtensions is Dummy, ERC165 {16interface ERC20UniqueExtensions is Dummy, ERC165 {
17 /// @dev EVM selector for this function is: 0xec069398,
18 /// or in textual repr: balanceOfCross((address,uint256))
19 function balanceOfCross(CrossAddress memory owner) external view returns (uint256);
20
17 /// @dev EVM selector for this function is: 0x2ada85ff,21 /// @dev EVM selector for this function is: 0x2ada85ff,
18 /// or in textual repr: transferCross((address,uint256),uint256)22 /// or in textual repr: transferCross((address,uint256),uint256)