I'm developing an Smart Contract based in the Openzeppelin's Crowdsale one. When I test the Crowdsale Smart Contract manually, sending ETH with metamask, the SC returns me the correct amount of tokens.
But when I try to do the same (send ETH to the Smart Contract's address) I always get an error on Metamask before sending the amount.
I have tried with: sendTransaction
web3.eth.sendTransaction({'to': toaddr, 'from': fromAddress, 'value': bnb_value})
(If I change the contract's address with a wallet address, the function sends the ETH correctly to the given wallet address, but not when the address is a contract addres).
buyTokens function
ico_contract.methods.buyTokens(fromaddr).estimateGas({
"value": bnb_value,
"from": fromAddress
})
I do not know how to continue...