Below is my fallback function for ethereum. It currently require 91000 gaslimit which is way more than 21000. Metamask always starts the transaction with 21000 gas stipend due to which transaction fails always. Is there anyway Metamask calculates the actual gas needed because I cannot tell each user individually to send 91000 gas along they will believe in gas whatever Metamask will suggest OR if we can reduce the gas price from 91000 to 21000 somehow.
function deposit() external payable {
makeDeposit(msg.sender, msg.value);
}
function makeDeposit(address sender, uint256 amount) internal {
require(balances[sender] == 0);
require(amount > 0);
balances[sender] = balances[sender].add(amount.mul(1000)); // mint new tokens
_totalSupply = _totalSupply.add(amount.mul(1000)); // track the supply
emit Transfer(address(0), sender, amount.mul(1000)); // notify of the transfer event
depositor[sender].time = now;
depositor[sender].amount = amount;
emit Deposited(sender, amount);
}