Skip to content

Commit de2049d

Browse files
committed
whoops
1 parent 14c2ce7 commit de2049d

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

runtime/src/lib.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,20 +1121,16 @@ const EVM_DECIMALS_FACTOR: u64 = 1_000_000_000_u64;
11211121
pub struct SubtensorEvmBalanceConverter;
11221122

11231123
impl BalanceConverter for SubtensorEvmBalanceConverter {
1124-
/// Convert from Substrate balance to EVM balance
11251124
fn into_evm_balance(value: U256) -> Option<U256> {
1126-
// Scale up by EVM_DECIMALS_FACTOR, ensuring no overflow
11271125
value.checked_mul(U256::from(EVM_DECIMALS_FACTOR))
11281126
}
11291127

1130-
/// Convert from EVM balance to Substrate balance
11311128
fn into_substrate_balance(value: U256) -> Option<U256> {
1132-
// Scale down by EVM_DECIMALS_FACTOR, truncating precision safely
11331129
value
11341130
.checked_div(U256::from(EVM_DECIMALS_FACTOR))
11351131
.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) {
11381134
Some(substrate_value)
11391135
} else {
11401136
None

0 commit comments

Comments
 (0)