hats-finance / illuminex-0x0bb4aa1f58719707405c231fcdf0b405714799cf

0 stars 1 forks source link

VaultBitcoinWallet : `importFees` is not realised #62

Open hats-bug-reporter[bot] opened 3 months ago

hats-bug-reporter[bot] commented 3 months ago

Github username: -- Twitter username: -- Submission hash (on-chain): 0xbb0713bde0b16f80b00c0ad3bf9a35a9002b648d4b3934b456b35c7ec077e939 Severity: medium

Description: Description\

when a deposit is made by, the internal call makes the _onActionDeposit function. where, we can see the following code block.

VaultBitcoinWallet.sol#L473-L486

        uint64 protocolFees = value * depositFee / 1000;
        if (isExcludedFromFees[destination]) {
            protocolFees = 0;
        }

        uint64 importFees = ((BYTES_PER_INCOMING_TRANSFER + INPUT_EXTRA_FIXED_BYTES_FEE) * satoshiPerByte);
        protocolFees += importFees;

        uint64 valueAfterFees = value - protocolFees;

        btcToken.mint(destination, valueAfterFees);
        if ((protocolFees - importFees) > 0 && destination != REFUEL_VAULT_ADDRESS) {
            btcToken.mint(owner(), protocolFees - importFees);
        }

if the destination is isExcludedFromFees , no protocol fee is charged.

importFees is computed and added with protocolFees.

The protocolFees is substracted from input value

valueAfterFees is minted to the destination address.

the protocol fee is minted by sbtracting the importfee.

If we see, nowhere the importFees is realised.

Impact\ importFees will be missed without utlising.

Attachments

  1. Revised Code File (Optional)

We are not sure why the importfee is charged. if it is planned to add with protocol fee, do not subtract it from protocol fee while minting the fee to owner.

party-for-illuminati commented 3 months ago

ImportFee is used to give users less amount to cover deposit input importing costs in Bitcoin network.

https://learnmeabitcoin.com/technical/transaction/fee/