solmd icon indicating copy to clipboard operation
solmd copied to clipboard

Support for ABIEncoderV2

Open naddison36 opened this issue 7 years ago • 0 comments

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;
    }
}

naddison36 avatar Jul 23 '18 05:07 naddison36