Skip to content

Function signature literals #1435

@pirapira

Description

@pirapira

Out of a gitter conversation there came an idea of looking up authorization_table[msg.sig][msg.caller]. For setting up such a table, it would be convenient to have function signature literals signature_hash(f(void)) that represents the signature hash.

contract C {
    mapping (bytes4 => mapping (address => bool)) authorization_table;
    modifier auth() {
        if (!authorization_table[msg.sig][msg.caller]) throw;
        _;
    }

    function interface() auth;
    function allow_interface(address _somebody) auth {
        authorization_table[signature_hash(interface(void))][_somebody] = true;
    }
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions