Skip to content

Instantly share code, notes, and snippets.

View nventuro's full-sized avatar

Nicolás Venturo nventuro

View GitHub Profile
### Keybase proof
I hereby claim:
* I am nventuro on github.
* I am nventuro (https://keybase.io/nventuro) on keybase.
* I have a public key ASClzIFtw6qKY5IUkHFMgNU1sSSHllBAD-9SfBjqZld8awo
To claim this, I am signing this object:
@nventuro
nventuro / AccessControl.sol
Last active May 10, 2022 09:29
Access Control Proposal
pragma solidity ^0.6.0;
import "./IAccessControl.sol";
import "../utils/EnumerableSet.sol";
abstract contract AccessControl is IAccessControl {
using EnumerableSet for EnumerableSet.AddressSet;
struct Role {
EnumerableSet.AddressSet members;
function findSelectors(bytecode) {
// We look for:
// * PUSH4 (0x63)
// * 8 bytes (the selector itself)
// * 2 optional bytes (a possible DUP, this is inserted when optimizations are enabled)
// * EQ (0x14)
// * One of:
// - PUSH1 (0x60) + 2 bytes (the jump destination)
// - PUSH2 (0x61) + 4 bytes (the jump destination)
// * JUMPI (0x57)