Open sh4dowb opened 1 year ago
I've temporarily fixed this by:
# We collect fees depending on the number of spread deposit size
# Example: if deposit spreads on three wallets need to collect eth fee for 3 transactions
fees = options.fetch(:gas_limit).to_d * options.fetch(:gas_price).to_d / 1000000000000000000 # eth decimals
amount = fees * deposit_spread.size
options[:gas_limit] = 21000 # eth gas limit
transaction.amount = amount
transaction.options = options
def create_eth_transaction!(transaction, options = {})
currency_options = @currency.fetch(:options).slice(:gas_limit, :gas_price)
options.merge!(DEFAULT_ETH_FEE, currency_options)
amount = (transaction.amount.to_d * 1000000000000000000).to_i # eth decimals
eth is working as well. also probably you should convert eth amount to token amount for min_collection thingy.
I realized removing/fixing the "Fee amount is greater than min collection amount" check might also fix this. 810^14 fee is converted to 810^8 by accident, instead of 810^-4 but when sending it will convert 810^8 to 8*10^14 again, by accident, so it should send the correct amount. two wrongs make one right lol
either something like above, or calculation of amount again when checking against min_collection must be done to fix this issue.
ETH: 18 subunits USDT: 6 subunits
Fee amount(902597579.715) is greater than min collection amount(20.0).
Dividing the wanted fee amount by remaining 10^12 results in 0.000902598, which is around the actual ETH fee required (~1 USD) But convert_from_base_amount function does not calculate fee with parent currency, resulting in this