File tree Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -1121,20 +1121,16 @@ const EVM_DECIMALS_FACTOR: u64 = 1_000_000_000_u64;
1121
1121
pub struct SubtensorEvmBalanceConverter ;
1122
1122
1123
1123
impl BalanceConverter for SubtensorEvmBalanceConverter {
1124
- /// Convert from Substrate balance to EVM balance
1125
1124
fn into_evm_balance ( value : U256 ) -> Option < U256 > {
1126
- // Scale up by EVM_DECIMALS_FACTOR, ensuring no overflow
1127
1125
value. checked_mul ( U256 :: from ( EVM_DECIMALS_FACTOR ) )
1128
1126
}
1129
1127
1130
- /// Convert from EVM balance to Substrate balance
1131
1128
fn into_substrate_balance ( value : U256 ) -> Option < U256 > {
1132
- // Scale down by EVM_DECIMALS_FACTOR, truncating precision safely
1133
1129
value
1134
1130
. checked_div ( U256 :: from ( EVM_DECIMALS_FACTOR ) )
1135
1131
. and_then ( |substrate_value| {
1136
- // Ensure the result fits in Substrate's Balance type (u128 )
1137
- if substrate_value <= U256 :: from ( u128 :: MAX ) {
1132
+ // Ensure the result fits within the Subtensor Balance type (u64 )
1133
+ if substrate_value <= U256 :: from ( u64 :: MAX ) {
1138
1134
Some ( substrate_value)
1139
1135
} else {
1140
1136
None
You can’t perform that action at this time.
0 commit comments