Skip to content

Instantly share code, notes, and snippets.

@niklabh
Created August 4, 2022 07:29
Show Gist options
  • Save niklabh/f61708028d419fe300ca67f13d33996e to your computer and use it in GitHub Desktop.
Save niklabh/f61708028d419fe300ca67f13d33996e to your computer and use it in GitHub Desktop.
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
contract ECDSA {
/**
* @dev Dummy implementation. This code is implemented in the precomiled contract
* @return A boolean confirming whether the public key is signer for the message.
*/
function verify(
bytes calldata public_key,
bytes calldata signature,
bytes calldata message
) external pure returns (bool){
if (public_key[0] == 0 || signature[0] == 0 || message[0] == 0) return false;
return true;
}
}
contract ECDSAtest {
ECDSA public ECDSAContract;
function initialise(address ecdsa) public {
ECDSAContract = ECDSA(ecdsa);
}
function verify(
bytes memory public_key,
bytes memory signature,
bytes memory smessage
) external view returns (bool) {
bool address_verified = ECDSAContract.verify(public_key, signature, smessage);
return address_verified;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment