Skip to content

Instantly share code, notes, and snippets.

@MCarlomagno
Created February 8, 2022 18:47
Show Gist options
  • Save MCarlomagno/44da58e059f9b7c1709c6d4f682c0bc3 to your computer and use it in GitHub Desktop.
Save MCarlomagno/44da58e059f9b7c1709c6d4f682c0bc3 to your computer and use it in GitHub Desktop.
pragma solidity >=0.7.0 <0.9.0;
import "github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.3/contracts/cryptography/ECDSA.sol";
import "github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.3/contracts/utils/ReentrancyGuard.sol";
contract UniDirectionalPaymentChannel is ReentrancyGuard {
// ...
function _verify(uint _amount, bytes memory _sig) private view returns (bool) {
return _getEthSignedHash(_amount).recover(_sig) == sender;
}
function verify(uint _amount, bytes memory _sig) external view returns (bool) {
return _verify(_amount, _sig);
}
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment