git.delta.rocks / unique-network / refs/commits / 1425d54d3655

difftreelog

refactor remove unused fn `convert_tuple_to_cross_account`

PraetorP2022-12-16parent: #9e7b960.patch.diff
in: master

1 file changed

modifiedpallets/common/src/eth.rsdiffbeforeafterboth
64 T::CrossAccountId::from_sub(account_id)64 T::CrossAccountId::from_sub(account_id)
65}65}
66
67/// Convert tuple `(address, uint256)` to `CrossAccountId`.
68///
69/// If `address` in the tuple has *default* value, then the canonical form is substrate,
70/// if `uint256` has *default* value, then the ethereum form is canonical,
71/// if both values are *default* or *non default*, then this is considered an invalid address and `Error` is returned.
72pub fn convert_tuple_to_cross_account<T: Config>(
73 eth_cross_account_id: (address, uint256),
74) -> evm_coder::execution::Result<T::CrossAccountId>
75where
76 T::AccountId: From<[u8; 32]>,
77{
78 if eth_cross_account_id == Default::default() {
79 Err("All fields of cross account is zeroed".into())
80 } else if eth_cross_account_id.0 == Default::default() {
81 Ok(convert_uint256_to_cross_account::<T>(
82 eth_cross_account_id.1,
83 ))
84 } else if eth_cross_account_id.1 == Default::default() {
85 Ok(T::CrossAccountId::from_eth(eth_cross_account_id.0))
86 } else {
87 Err("All fields of cross account is non zeroed".into())
88 }
89}
9066
91/// Cross account struct67/// Cross account struct
92#[derive(Debug, Default, AbiCoder)]68#[derive(Debug, Default, AbiCoder)]