Skip to content
This repository has been archived by the owner on Sep 8, 2022. It is now read-only.

Support for ABIEncoderV2 #39

Open
naddison36 opened this issue Jul 23, 2018 · 0 comments
Open

Support for ABIEncoderV2 #39

naddison36 opened this issue Jul 23, 2018 · 0 comments

Comments

@naddison36
Copy link

ABIEncoderV2 allows structs to be passed as function params or return values. This is currently breaking solmd. For example, the follow contract fails to produce any markdown because the sig param in the validateSignature function is a struct.

pragma experimental ABIEncoderV2;
pragma solidity ^0.4.24;

contract Verifier
{
    // Represents the output of an ECDSA signature
    struct Signature {
        uint8 v;
        bytes32 r;
        bytes32 s;
    }

    /**
    @notice validates an address signed a message hash
    @param _addr public address of the private key that signed the message hash
    @param messageHash a keccak256 hash of the message being signed
    @param sig the signer's ECDSA signature of type Signature struct
    @return {
        "done": "true if the public address signed the message hash"
    }
    */
    function validateSignature(address _addr, bytes32 messageHash, Signature sig)
    public pure
    returns (bool done) {
        return ecrecover(messageHash, sig.v, sig.r, sig.s) == _addr;
    }
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant