I wanna call my smart contract function using ethersjs , but when i call function i got this error:
Unhandled Runtime Error Error: cannot estimate gas; transaction may fail or may require manual gas limit [ See: https://links.ethers.org/v5-errors-UNPREDICTABLE_GAS_LIMIT ] (reason="execution reverted", method="estimateGas", transaction={"from":"0x1204D7F27702d793260Ad5a406dDEE7660d21B61","to":"0xf3BfC4Ce2c8392fc93D24e74193b1d133320126e","data":"0x15364cd50000000000000000000000001204d7f27702d793260ad5a406ddee7660d21b61","accessList":null}, error={"code":-32000,"message":"execution reverted"}, code=UNPREDICTABLE_GAS_LIMIT, version=providers/5.7.2)
and here is my function codes:
const _faucetContract = new ethers.Contract(faucetContractAddress , faucetAbi , signer )
const getFaucetToken = async () => {
await _faucetContract.getFaucet(signerAddress)
}
and that's my function in .sol contract:
function getFaucet(address user) external {
require(msg.sender == user, 'you can not sent token for another address');
require(msg.sender != address(0),"address zero");
require(timeLastFaucet[msg.sender] + 1 days < block.timestamp,"once a day");
_mint(user, 50000000000000000000);
timeLastFaucet[msg.sender] = block.timestamp ;
}
i think i should set gas fee and gas limit for my function but i don't know how??
can anyone explain how i can define arguments and details that we need to call contract functions?
Thanks a lot.