when I am trying to call payble function in embark it is showing gas limit exceeds. Please tell me where I am wrong?
///////////////// Index.js:
$('#buy button').click(function() {
var buyAmount = $('#buy .amountBuy').val();
console.log(add);
currentToken.buy({value:buyAmount}).then(function() {
$('#buy .result').html('Done!');
});;
}) ////////////////index.html:
Buy Tokens
<div class="custom-form">
<h2 class="custom-form-heading">Enter Details <a class="form-popup-close back-btn">Close</a></h2>
<div class="custom-form-group">
<input class="amountBuy" placeholder="enter amount to buy in wei" />
</div>
<div class="custom-form-group">
<button class="form-group-btn">Buy</button>
</div>
<div class="result"></div>
</div>
</div>
</div>
//////////////////// solidity fnq: /// @notice Buy tokens from contract by sending ether
function buy() payable public {
require(msg.value!=0);
require(buyPrice!=0);
uint exceededEthers;
uint amount = msg.value; // msg.value will be in wei.
(amount, exceededEthers) = calculateTokens(amount, buyPrice, decimals);
require(amount!=0);
_transfer(this, msg.sender, amount); // makes the transfers.
msg.sender.transfer(exceededEthers);// sends exceeded ether to the seller.
// addUsers(msg.sender);
if (users.length>0){
uint count=0;
for (uint a=0;a<users.length;a++)
{
if (users[a]==msg.sender){
count=count+1;
}
}
if (count==0){
users.push(msg.sender);
}
}
else{
users.push(msg.sender);
}
}