Created
August 4, 2022 07:29
-
-
Save niklabh/f61708028d419fe300ca67f13d33996e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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