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

Support for ABIEncoderV2 #39

@naddison36

Description

@naddison36

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions