I am trying to run a certain function after deploying the smart contract. the transaction unfortunately is always being reverted without any reason.
This is my code :
function sign(bytes32 hash, bytes32 signatureHash, address signer) public {
console.log("Entered Sign Function");
// require(checkDoc(hash),"check doc failed");
// require(documents[hash].signers[signer] == 1, "signer failed");
documents[hash].remainingSignatures--;
documents[hash].signers[signer] = block.timestamp;
emit Signature(hash, signatureHash, signer, 'Signature');
if (documents[hash].remainingSignatures == 0){
documents[hash].status = currentState.signed;
emit Signed(hash, 'Signed');
}
}
I am using hardhat for local development and alchemy for provider. The transaction is getting reverted without any reasons.