Skip to content

Instantly share code, notes, and snippets.

View joaoaguiam's full-sized avatar

Joao Aguiam joaoaguiam

View GitHub Profile
address public grantSigner;
function stake(address _userUportAddress, uint _expiryDate, bytes _signature) public payable whenNotPaused {
bytes32 hashMessage = keccak256(abi.encodePacked(_userUportAddress, msg.value, _expiryDate));
address signer = hashMessage.toEthSignedMessageHash().recover(_signature);
require(signer == grantSigner, "Signature is not valid");
require(block.timestamp < _expiryDate, "Grant is expired");
require(userStakedAddress[_userUportAddress] == 0, "User has already staked!");