ETH Price: $3,441.24 (-1.34%)
Gas: 10 Gwei

Contract

0x96f041b96708813b1D789606926c524e78543664
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Grant Permission63082162018-09-10 21:10:292137 days ago1536613829IN
0x96f041b9...e78543664
0 ETH0.000104664.1
0x6060604052530572018-03-14 9:26:352317 days ago1521019595IN
 Create: ACL
0 ETH0.006259764

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ACL

Compiler Version
v0.4.18+commit.9cf6e910

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2018-03-14
*/

//File: contracts/acl/IACL.sol
pragma solidity ^0.4.18;


interface IACL {
    function initialize(address permissionsCreator) public;
    function hasPermission(address who, address where, bytes32 what, bytes how) public view returns (bool);
}

//File: contracts/kernel/IKernel.sol
pragma solidity ^0.4.18;



interface IKernel {
    event SetApp(bytes32 indexed namespace, bytes32 indexed name, bytes32 indexed id, address app);

    function acl() public view returns (IACL);
    function hasPermission(address who, address where, bytes32 what, bytes how) public view returns (bool);

    function setApp(bytes32 namespace, bytes32 name, address app) public returns (bytes32 id);
    function getApp(bytes32 id) public view returns (address);
}
//File: contracts/apps/AppStorage.sol
pragma solidity ^0.4.18;




contract AppStorage {
    IKernel public kernel;
    bytes32 public appId;
    address internal pinnedCode; // used by Proxy Pinned
    uint256 internal initializationBlock; // used by Initializable
    uint256[95] private storageOffset; // forces App storage to start at after 100 slots
    uint256 private offset;
}

//File: contracts/common/Initializable.sol
pragma solidity ^0.4.18;




contract Initializable is AppStorage {
    modifier onlyInit {
        require(initializationBlock == 0);
        _;
    }

    /**
    * @return Block number in which the contract was initialized
    */
    function getInitializationBlock() public view returns (uint256) {
        return initializationBlock;
    }

    /**
    * @dev Function to be called by top level contract after initialization has finished.
    */
    function initialized() internal onlyInit {
        initializationBlock = getBlockNumber();
    }

    /**
    * @dev Returns the current block number.
    *      Using a function rather than `block.number` allows us to easily mock the block number in
    *      tests.
    */
    function getBlockNumber() internal view returns (uint256) {
        return block.number;
    }
}

//File: contracts/evmscript/IEVMScriptExecutor.sol
pragma solidity ^0.4.18;


interface IEVMScriptExecutor {
    function execScript(bytes script, bytes input, address[] blacklist) external returns (bytes);
}

//File: contracts/evmscript/IEVMScriptRegistry.sol
pragma solidity 0.4.18;


contract EVMScriptRegistryConstants {
    bytes32 constant public EVMSCRIPT_REGISTRY_APP_ID = keccak256("evmreg.aragonpm.eth");
    bytes32 constant public EVMSCRIPT_REGISTRY_APP = keccak256(keccak256("app"), EVMSCRIPT_REGISTRY_APP_ID);
}


interface IEVMScriptRegistry {
    function addScriptExecutor(address executor) external returns (uint id);
    function disableScriptExecutor(uint256 executorId) external;

    function getScriptExecutor(bytes script) public view returns (address);
}
//File: contracts/evmscript/ScriptHelpers.sol
pragma solidity 0.4.18;


library ScriptHelpers {
    // To test with JS and compare with actual encoder. Maintaining for reference.
    // t = function() { return IEVMScriptExecutor.at('0x4bcdd59d6c77774ee7317fc1095f69ec84421e49').contract.execScript.getData(...[].slice.call(arguments)).slice(10).match(/.{1,64}/g) }
    // run = function() { return ScriptHelpers.new().then(sh => { sh.abiEncode.call(...[].slice.call(arguments)).then(a => console.log(a.slice(2).match(/.{1,64}/g)) ) }) }
    // This is truly not beautiful but lets no daydream to the day solidity gets reflection features

    function abiEncode(bytes _a, bytes _b, address[] _c) public pure returns (bytes d) {
        return encode(_a, _b, _c);
    }

    function encode(bytes memory _a, bytes memory _b, address[] memory _c) internal pure returns (bytes memory d) {
        // A is positioned after the 3 position words
        uint256 aPosition = 0x60;
        uint256 bPosition = aPosition + 32 * abiLength(_a);
        uint256 cPosition = bPosition + 32 * abiLength(_b);
        uint256 length = cPosition + 32 * abiLength(_c);

        d = new bytes(length);
        assembly {
            // Store positions
            mstore(add(d, 0x20), aPosition)
            mstore(add(d, 0x40), bPosition)
            mstore(add(d, 0x60), cPosition)
        }

        // Copy memory to correct position
        copy(d, getPtr(_a), aPosition, _a.length);
        copy(d, getPtr(_b), bPosition, _b.length);
        copy(d, getPtr(_c), cPosition, _c.length * 32); // 1 word per address
    }

    function abiLength(bytes memory _a) internal pure returns (uint256) {
        // 1 for length +
        // memory words + 1 if not divisible for 32 to offset word
        return 1 + (_a.length / 32) + (_a.length % 32 > 0 ? 1 : 0);
    }

    function abiLength(address[] _a) internal pure returns (uint256) {
        // 1 for length + 1 per item
        return 1 + _a.length;
    }

    function copy(bytes _d, uint256 _src, uint256 _pos, uint256 _length) internal pure {
        uint dest;
        assembly {
            dest := add(add(_d, 0x20), _pos)
        }
        memcpy(dest, _src, _length + 32);
    }

    function getPtr(bytes memory _x) internal pure returns (uint256 ptr) {
        assembly {
            ptr := _x
        }
    }

    function getPtr(address[] memory _x) internal pure returns (uint256 ptr) {
        assembly {
            ptr := _x
        }
    }

    function getSpecId(bytes _script) internal pure returns (uint32) {
        return uint32At(_script, 0);
    }

    function uint256At(bytes _data, uint256 _location) internal pure returns (uint256 result) {
        assembly {
            result := mload(add(_data, add(0x20, _location)))
        }
    }

    function addressAt(bytes _data, uint256 _location) internal pure returns (address result) {
        uint256 word = uint256At(_data, _location);

        assembly {
            result := div(and(word, 0xffffffffffffffffffffffffffffffffffffffff000000000000000000000000),
            0x1000000000000000000000000)
        }
    }

    function uint32At(bytes _data, uint256 _location) internal pure returns (uint32 result) {
        uint256 word = uint256At(_data, _location);

        assembly {
            result := div(and(word, 0xffffffff00000000000000000000000000000000000000000000000000000000),
            0x100000000000000000000000000000000000000000000000000000000)
        }
    }

    function locationOf(bytes _data, uint256 _location) internal pure returns (uint256 result) {
        assembly {
            result := add(_data, add(0x20, _location))
        }
    }

    function toBytes(bytes4 _sig) internal pure returns (bytes) {
        bytes memory payload = new bytes(4);
        payload[0] = bytes1(_sig);
        payload[1] = bytes1(_sig << 8);
        payload[2] = bytes1(_sig << 16);
        payload[3] = bytes1(_sig << 24);
        return payload;
    }

    function memcpy(uint _dest, uint _src, uint _len) public pure {
        uint256 src = _src;
        uint256 dest = _dest;
        uint256 len = _len;

        // Copy word-length chunks while possible
        for (; len >= 32; len -= 32) {
            assembly {
                mstore(dest, mload(src))
            }
            dest += 32;
            src += 32;
        }

        // Copy remaining bytes
        uint mask = 256 ** (32 - len) - 1;
        assembly {
            let srcpart := and(mload(src), not(mask))
            let destpart := and(mload(dest), mask)
            mstore(dest, or(destpart, srcpart))
        }
    }
}
//File: contracts/evmscript/EVMScriptRunner.sol
pragma solidity ^0.4.18;








contract EVMScriptRunner is AppStorage, EVMScriptRegistryConstants {
    using ScriptHelpers for bytes;

    function runScript(bytes _script, bytes _input, address[] _blacklist) protectState internal returns (bytes output) {
        // TODO: Too much data flying around, maybe extracting spec id here is cheaper
        address executorAddr = getExecutor(_script);
        require(executorAddr != address(0));

        bytes memory calldataArgs = _script.encode(_input, _blacklist);
        bytes4 sig = IEVMScriptExecutor(0).execScript.selector;

        require(executorAddr.delegatecall(sig, calldataArgs));

        return returnedDataDecoded();
    }

    function getExecutor(bytes _script) public view returns (IEVMScriptExecutor) {
        return IEVMScriptExecutor(getExecutorRegistry().getScriptExecutor(_script));
    }

    // TODO: Internal
    function getExecutorRegistry() internal view returns (IEVMScriptRegistry) {
        address registryAddr = kernel.getApp(EVMSCRIPT_REGISTRY_APP);
        return IEVMScriptRegistry(registryAddr);
    }

    /**
    * @dev copies and returns last's call data. Needs to ABI decode first
    */
    function returnedDataDecoded() internal view returns (bytes ret) {
        assembly {
            let size := returndatasize
            switch size
            case 0 {}
            default {
                ret := mload(0x40) // free mem ptr get
                mstore(0x40, add(ret, add(size, 0x20))) // free mem ptr set
                returndatacopy(ret, 0x20, sub(size, 0x20)) // copy return data
            }
        }
        return ret;
    }

    modifier protectState {
        address preKernel = kernel;
        bytes32 preAppId = appId;
        _; // exec
        require(kernel == preKernel);
        require(appId == preAppId);
    }
}
//File: contracts/acl/ACLSyntaxSugar.sol
pragma solidity 0.4.18;


contract ACLSyntaxSugar {
    function arr() internal pure returns (uint256[] r) {}

    function arr(bytes32 _a) internal pure returns (uint256[] r) {
        return arr(uint256(_a));
    }

    function arr(bytes32 _a, bytes32 _b) internal pure returns (uint256[] r) {
        return arr(uint256(_a), uint256(_b));
    }

    function arr(address _a) internal pure returns (uint256[] r) {
        return arr(uint256(_a));
    }

    function arr(address _a, address _b) internal pure returns (uint256[] r) {
        return arr(uint256(_a), uint256(_b));
    }

    function arr(address _a, uint256 _b, uint256 _c) internal pure returns (uint256[] r) {
        return arr(uint256(_a), _b, _c);
    }

    function arr(address _a, uint256 _b) internal pure returns (uint256[] r) {
        return arr(uint256(_a), uint256(_b));
    }

    function arr(address _a, address _b, uint256 _c, uint256 _d, uint256 _e) internal pure returns (uint256[] r) {
        return arr(uint256(_a), uint256(_b), _c, _d, _e);
    }

    function arr(address _a, address _b, address _c) internal pure returns (uint256[] r) {
        return arr(uint256(_a), uint256(_b), uint256(_c));
    }

    function arr(address _a, address _b, uint256 _c) internal pure returns (uint256[] r) {
        return arr(uint256(_a), uint256(_b), uint256(_c));
    }

    function arr(uint256 _a) internal pure returns (uint256[] r) {
        r = new uint256[](1);
        r[0] = _a;
    }

    function arr(uint256 _a, uint256 _b) internal pure returns (uint256[] r) {
        r = new uint256[](2);
        r[0] = _a;
        r[1] = _b;
    }

    function arr(uint256 _a, uint256 _b, uint256 _c) internal pure returns (uint256[] r) {
        r = new uint256[](3);
        r[0] = _a;
        r[1] = _b;
        r[2] = _c;
    }

    function arr(uint256 _a, uint256 _b, uint256 _c, uint256 _d) internal pure returns (uint256[] r) {
        r = new uint256[](4);
        r[0] = _a;
        r[1] = _b;
        r[2] = _c;
        r[3] = _d;
    }

    function arr(uint256 _a, uint256 _b, uint256 _c, uint256 _d, uint256 _e) internal pure returns (uint256[] r) {
        r = new uint256[](5);
        r[0] = _a;
        r[1] = _b;
        r[2] = _c;
        r[3] = _d;
        r[4] = _e;
    }
}


contract ACLHelpers {
    function decodeParamOp(uint256 _x) internal pure returns (uint8 b) {
        return uint8(_x >> (8 * 30));
    }

    function decodeParamId(uint256 _x) internal pure returns (uint8 b) {
        return uint8(_x >> (8 * 31));
    }

    function decodeParamsList(uint256 _x) internal pure returns (uint32 a, uint32 b, uint32 c) {
        a = uint32(_x);
        b = uint32(_x >> (8 * 4));
        c = uint32(_x >> (8 * 8));
    }
}

//File: contracts/apps/AragonApp.sol
pragma solidity ^0.4.18;







contract AragonApp is AppStorage, Initializable, ACLSyntaxSugar, EVMScriptRunner {
    modifier auth(bytes32 _role) {
        require(canPerform(msg.sender, _role, new uint256[](0)));
        _;
    }

    modifier authP(bytes32 _role, uint256[] params) {
        require(canPerform(msg.sender, _role, params));
        _;
    }

    function canPerform(address _sender, bytes32 _role, uint256[] params) public view returns (bool) {
        bytes memory how; // no need to init memory as it is never used
        if (params.length > 0) {
            uint256 byteLength = params.length * 32;
            assembly {
                how := params // forced casting
                mstore(how, byteLength)
            }
        }
        return address(kernel) == 0 || kernel.hasPermission(_sender, address(this), _role, how);
    }
}

//File: contracts/acl/ACL.sol
pragma solidity 0.4.18;






interface ACLOracle {
    function canPerform(address who, address where, bytes32 what) public view returns (bool);
}


contract ACL is IACL, AragonApp, ACLHelpers {
    bytes32 constant public CREATE_PERMISSIONS_ROLE = keccak256("CREATE_PERMISSIONS_ROLE");

    // whether a certain entity has a permission
    mapping (bytes32 => bytes32) permissions; // 0 for no permission, or parameters id
    mapping (bytes32 => Param[]) public permissionParams;

    // who is the manager of a permission
    mapping (bytes32 => address) permissionManager;

    enum Op { NONE, EQ, NEQ, GT, LT, GTE, LTE, NOT, AND, OR, XOR, IF_ELSE, RET } // op types

    struct Param {
        uint8 id;
        uint8 op;
        uint240 value; // even though value is an uint240 it can store addresses
        // in the case of 32 byte hashes losing 2 bytes precision isn't a huge deal
        // op and id take less than 1 byte each so it can be kept in 1 sstore
    }

    uint8 constant BLOCK_NUMBER_PARAM_ID = 200;
    uint8 constant TIMESTAMP_PARAM_ID    = 201;
    uint8 constant SENDER_PARAM_ID       = 202;
    uint8 constant ORACLE_PARAM_ID       = 203;
    uint8 constant LOGIC_OP_PARAM_ID     = 204;
    uint8 constant PARAM_VALUE_PARAM_ID  = 205;
    // TODO: Add execution times param type?

    bytes32 constant public EMPTY_PARAM_HASH = keccak256(uint256(0));
    address constant ANY_ENTITY = address(-1);

    modifier onlyPermissionManager(address _app, bytes32 _role) {
        require(msg.sender == getPermissionManager(_app, _role));
        _;
    }

    event SetPermission(address indexed entity, address indexed app, bytes32 indexed role, bool allowed);
    event ChangePermissionManager(address indexed app, bytes32 indexed role, address indexed manager);

    /**
    * @dev Initialize can only be called once. It saves the block number in which it was initialized.
    * @notice Initializes an ACL instance and sets `_permissionsCreator` as the entity that can create other permissions
    * @param _permissionsCreator Entity that will be given permission over createPermission
    */
    function initialize(address _permissionsCreator) onlyInit public {
        initialized();
        require(msg.sender == address(kernel));

        _createPermission(_permissionsCreator, this, CREATE_PERMISSIONS_ROLE, _permissionsCreator);
    }

    /**
    * @dev Creates a permission that wasn't previously set. Access is limited by the ACL.
    *      If a created permission is removed it is possible to reset it with createPermission.
    * @notice Create a new permission granting `_entity` the ability to perform actions of role `_role` on `_app` (setting `_manager` as the permission manager)
    * @param _entity Address of the whitelisted entity that will be able to perform the role
    * @param _app Address of the app in which the role will be allowed (requires app to depend on kernel for ACL)
    * @param _role Identifier for the group of actions in app given access to perform
    * @param _manager Address of the entity that will be able to grant and revoke the permission further.
    */
    function createPermission(address _entity, address _app, bytes32 _role, address _manager) external {
        require(hasPermission(msg.sender, address(this), CREATE_PERMISSIONS_ROLE));

        _createPermission(_entity, _app, _role, _manager);
    }

    /**
    * @dev Grants permission if allowed. This requires `msg.sender` to be the permission manager
    * @notice Grants `_entity` the ability to perform actions of role `_role` on `_app`
    * @param _entity Address of the whitelisted entity that will be able to perform the role
    * @param _app Address of the app in which the role will be allowed (requires app to depend on kernel for ACL)
    * @param _role Identifier for the group of actions in app given access to perform
    */
    function grantPermission(address _entity, address _app, bytes32 _role)
        external
    {
        grantPermissionP(_entity, _app, _role, new uint256[](0));
    }

    /**
    * @dev Grants a permission with parameters if allowed. This requires `msg.sender` to be the permission manager
    * @notice Grants `_entity` the ability to perform actions of role `_role` on `_app`
    * @param _entity Address of the whitelisted entity that will be able to perform the role
    * @param _app Address of the app in which the role will be allowed (requires app to depend on kernel for ACL)
    * @param _role Identifier for the group of actions in app given access to perform
    * @param _params Permission parameters
    */
    function grantPermissionP(address _entity, address _app, bytes32 _role, uint256[] _params)
        onlyPermissionManager(_app, _role)
        public
    {
        require(!hasPermission(_entity, _app, _role));

        bytes32 paramsHash = _params.length > 0 ? _saveParams(_params) : EMPTY_PARAM_HASH;
        _setPermission(_entity, _app, _role, paramsHash);
    }

    /**
    * @dev Revokes permission if allowed. This requires `msg.sender` to be the the permission manager
    * @notice Revokes `_entity` the ability to perform actions of role `_role` on `_app`
    * @param _entity Address of the whitelisted entity to revoke access from
    * @param _app Address of the app in which the role will be revoked
    * @param _role Identifier for the group of actions in app being revoked
    */
    function revokePermission(address _entity, address _app, bytes32 _role)
        onlyPermissionManager(_app, _role)
        external
    {
        require(hasPermission(_entity, _app, _role));

        _setPermission(_entity, _app, _role, bytes32(0));
    }

    /**
    * @notice Sets `_newManager` as the manager of the permission `_role` in `_app`
    * @param _newManager Address for the new manager
    * @param _app Address of the app in which the permission management is being transferred
    * @param _role Identifier for the group of actions being transferred
    */
    function setPermissionManager(address _newManager, address _app, bytes32 _role)
        onlyPermissionManager(_app, _role)
        external
    {
        _setPermissionManager(_newManager, _app, _role);
    }

    /**
    * @dev Get manager for permission
    * @param _app Address of the app
    * @param _role Identifier for a group of actions in app
    * @return address of the manager for the permission
    */
    function getPermissionManager(address _app, bytes32 _role) public view returns (address) {
        return permissionManager[roleHash(_app, _role)];
    }

    /**
    * @dev Function called by apps to check ACL on kernel or to check permission statu
    * @param _who Sender of the original call
    * @param _where Address of the app
    * @param _where Identifier for a group of actions in app
    * @param _how Permission parameters
    * @return boolean indicating whether the ACL allows the role or not
    */
    function hasPermission(address _who, address _where, bytes32 _what, bytes memory _how) public view returns (bool) {
        uint256[] memory how;
        uint256 intsLength = _how.length / 32;
        assembly {
            how := _how // forced casting
            mstore(how, intsLength)
        }
        // _how is invalid from this point fwd
        return hasPermission(_who, _where, _what, how);
    }

    function hasPermission(address _who, address _where, bytes32 _what, uint256[] memory _how) public view returns (bool) {
        bytes32 whoParams = permissions[permissionHash(_who, _where, _what)];
        if (whoParams != bytes32(0) && evalParams(whoParams, _who, _where, _what, _how)) {
            return true;
        }

        bytes32 anyParams = permissions[permissionHash(ANY_ENTITY, _where, _what)];
        if (anyParams != bytes32(0) && evalParams(anyParams, ANY_ENTITY, _where, _what, _how)) {
            return true;
        }

        return false;
    }

    function hasPermission(address _who, address _where, bytes32 _what) public view returns (bool) {
        uint256[] memory empty = new uint256[](0);
        return hasPermission(_who, _where, _what, empty);
    }

    /**
    * @dev Internal createPermission for access inside the kernel (on instantiation)
    */
    function _createPermission(address _entity, address _app, bytes32 _role, address _manager) internal {
        // only allow permission creation (or re-creation) when there is no manager
        require(getPermissionManager(_app, _role) == address(0));

        _setPermission(_entity, _app, _role, EMPTY_PARAM_HASH);
        _setPermissionManager(_manager, _app, _role);
    }

    /**
    * @dev Internal function called to actually save the permission
    */
    function _setPermission(address _entity, address _app, bytes32 _role, bytes32 _paramsHash) internal {
        permissions[permissionHash(_entity, _app, _role)] = _paramsHash;

        SetPermission(_entity, _app, _role, _paramsHash != bytes32(0));
    }

    function _saveParams(uint256[] _encodedParams) internal returns (bytes32) {
        bytes32 paramHash = keccak256(_encodedParams);
        Param[] storage params = permissionParams[paramHash];

        if (params.length == 0) { // params not saved before
            for (uint256 i = 0; i < _encodedParams.length; i++) {
                uint256 encodedParam = _encodedParams[i];
                Param memory param = Param(decodeParamId(encodedParam), decodeParamOp(encodedParam), uint240(encodedParam));
                params.push(param);
            }
        }

        return paramHash;
    }

    function evalParams(
        bytes32 _paramsHash,
        address _who,
        address _where,
        bytes32 _what,
        uint256[] _how
    ) internal view returns (bool)
    {
        if (_paramsHash == EMPTY_PARAM_HASH) {
            return true;
        }

        return evalParam(_paramsHash, 0, _who, _where, _what, _how);
    }

    function evalParam(
        bytes32 _paramsHash,
        uint32 _paramId,
        address _who,
        address _where,
        bytes32 _what,
        uint256[] _how
    ) internal view returns (bool)
    {
        if (_paramId >= permissionParams[_paramsHash].length) {
            return false; // out of bounds
        }

        Param memory param = permissionParams[_paramsHash][_paramId];

        if (param.id == LOGIC_OP_PARAM_ID) {
            return evalLogic(param, _paramsHash, _who, _where, _what, _how);
        }

        uint256 value;
        uint256 comparedTo = uint256(param.value);

        // get value
        if (param.id == ORACLE_PARAM_ID) {
            value = ACLOracle(param.value).canPerform(_who, _where, _what) ? 1 : 0;
            comparedTo = 1;
        } else if (param.id == BLOCK_NUMBER_PARAM_ID) {
            value = blockN();
        } else if (param.id == TIMESTAMP_PARAM_ID) {
            value = time();
        } else if (param.id == SENDER_PARAM_ID) {
            value = uint256(msg.sender);
        } else if (param.id == PARAM_VALUE_PARAM_ID) {
            value = uint256(param.value);
        } else {
            if (param.id >= _how.length) {
                return false;
            }
            value = uint256(uint240(_how[param.id])); // force lost precision
        }

        if (Op(param.op) == Op.RET) {
            return uint256(value) > 0;
        }

        return compare(value, Op(param.op), comparedTo);
    }

    function evalLogic(Param _param, bytes32 _paramsHash, address _who, address _where, bytes32 _what, uint256[] _how) internal view returns (bool) {
        if (Op(_param.op) == Op.IF_ELSE) {
            var (condition, success, failure) = decodeParamsList(uint256(_param.value));
            bool result = evalParam(_paramsHash, condition, _who, _where, _what, _how);

            return evalParam(_paramsHash, result ? success : failure, _who, _where, _what, _how);
        }

        var (v1, v2,) = decodeParamsList(uint256(_param.value));
        bool r1 = evalParam(_paramsHash, v1, _who, _where, _what, _how);

        if (Op(_param.op) == Op.NOT) {
            return !r1;
        }

        if (r1 && Op(_param.op) == Op.OR) {
            return true;
        }

        if (!r1 && Op(_param.op) == Op.AND) {
            return false;
        }

        bool r2 = evalParam(_paramsHash, v2, _who, _where, _what, _how);

        if (Op(_param.op) == Op.XOR) {
            return (r1 && !r2) || (!r1 && r2);
        }

        return r2; // both or and and depend on result of r2 after checks
    }

    function compare(uint256 _a, Op _op, uint256 _b) internal pure returns (bool) {
        if (_op == Op.EQ)  return _a == _b;                              // solium-disable-line lbrace
        if (_op == Op.NEQ) return _a != _b;                              // solium-disable-line lbrace
        if (_op == Op.GT)  return _a > _b;                               // solium-disable-line lbrace
        if (_op == Op.LT)  return _a < _b;                               // solium-disable-line lbrace
        if (_op == Op.GTE) return _a >= _b;                              // solium-disable-line lbrace
        if (_op == Op.LTE) return _a <= _b;                              // solium-disable-line lbrace
        return false;
    }

    /**
    * @dev Internal function that sets management
    */
    function _setPermissionManager(address _newManager, address _app, bytes32 _role) internal {
        permissionManager[roleHash(_app, _role)] = _newManager;
        ChangePermissionManager(_app, _role, _newManager);
    }

    function roleHash(address _where, bytes32 _what) pure internal returns (bytes32) {
        return keccak256(uint256(1), _where, _what);
    }

    function permissionHash(address _who, address _where, bytes32 _what) pure internal returns (bytes32) {
        return keccak256(uint256(2), _who, _where, _what);
    }

    function time() internal view returns (uint64) { return uint64(block.timestamp); } // solium-disable-line security/no-block-members

    function blockN() internal view returns (uint256) { return block.number; }
}

Contract Security Audit

Contract ABI

[{"constant":false,"inputs":[{"name":"_entity","type":"address"},{"name":"_app","type":"address"},{"name":"_role","type":"bytes32"}],"name":"grantPermission","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CREATE_PERMISSIONS_ROLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EVMSCRIPT_REGISTRY_APP_ID","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_entity","type":"address"},{"name":"_app","type":"address"},{"name":"_role","type":"bytes32"},{"name":"_params","type":"uint256[]"}],"name":"grantPermissionP","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"},{"name":"_where","type":"address"},{"name":"_what","type":"bytes32"}],"name":"hasPermission","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"},{"name":"","type":"uint256"}],"name":"permissionParams","outputs":[{"name":"id","type":"uint8"},{"name":"op","type":"uint8"},{"name":"value","type":"uint240"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"appId","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getInitializationBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EVMSCRIPT_REGISTRY_APP","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_entity","type":"address"},{"name":"_app","type":"address"},{"name":"_role","type":"bytes32"}],"name":"revokePermission","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_sender","type":"address"},{"name":"_role","type":"bytes32"},{"name":"params","type":"uint256[]"}],"name":"canPerform","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newManager","type":"address"},{"name":"_app","type":"address"},{"name":"_role","type":"bytes32"}],"name":"setPermissionManager","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_app","type":"address"},{"name":"_role","type":"bytes32"}],"name":"getPermissionManager","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_entity","type":"address"},{"name":"_app","type":"address"},{"name":"_role","type":"bytes32"},{"name":"_manager","type":"address"}],"name":"createPermission","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_permissionsCreator","type":"address"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"EMPTY_PARAM_HASH","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"kernel","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"},{"name":"_where","type":"address"},{"name":"_what","type":"bytes32"},{"name":"_how","type":"uint256[]"}],"name":"hasPermission","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_script","type":"bytes"}],"name":"getExecutor","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"},{"name":"_where","type":"address"},{"name":"_what","type":"bytes32"},{"name":"_how","type":"bytes"}],"name":"hasPermission","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"entity","type":"address"},{"indexed":true,"name":"app","type":"address"},{"indexed":true,"name":"role","type":"bytes32"},{"indexed":false,"name":"allowed","type":"bool"}],"name":"SetPermission","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"app","type":"address"},{"indexed":true,"name":"role","type":"bytes32"},{"indexed":true,"name":"manager","type":"address"}],"name":"ChangePermissionManager","type":"event"}]

6060604052341561000f57600080fd5b6116548061001e6000396000f3006060604052600436106100f85763ffffffff60e060020a6000350416630a8ed3db81146100fd5780633d6ab68f1461012757806360b1e0571461014c5780636815c9921461015f5780636d6712d8146101c9578063710a83151461020557806380afdea8146102525780638b3dd749146102655780639b3fdf4c146102785780639d0effdb1461028b578063a1658fad146102b3578063afd925df14610316578063b19057271461033e578063be0384781461037c578063c4d66de8146103ab578063c513f66e146103ca578063d4aae0c4146103dd578063f520b58d146103f0578063f92a79ff1461045a578063fdef9106146104ab575b600080fd5b341561010857600080fd5b610125600160a060020a0360043581169060243516604435610517565b005b341561013257600080fd5b61013a610547565b60405190815260200160405180910390f35b341561015757600080fd5b61013a61057b565b341561016a57600080fd5b610125600160a060020a036004803582169160248035909116916044359160849060643590810190830135806020818102016040519081016040528093929190818152602001838360200280828437509496506105af95505050505050565b34156101d457600080fd5b6101f1600160a060020a0360043581169060243516604435610632565b604051901515815260200160405180910390f35b341561021057600080fd5b61021e600435602435610673565b60405160ff9384168152919092166020820152600160f060020a039091166040808301919091526060909101905180910390f35b341561025d57600080fd5b61013a6106bb565b341561027057600080fd5b61013a6106c1565b341561028357600080fd5b61013a6106c8565b341561029657600080fd5b610125600160a060020a0360043581169060243516604435610744565b34156102be57600080fd5b6101f160048035600160a060020a031690602480359190606490604435908101908301358060208082020160405190810160405280939291908181526020018383602002808284375094965061079995505050505050565b341561032157600080fd5b610125600160a060020a03600435811690602435166044356108d7565b341561034957600080fd5b610360600160a060020a036004351660243561090d565b604051600160a060020a03909116815260200160405180910390f35b341561038757600080fd5b610125600160a060020a03600435811690602435811690604435906064351661093e565b34156103b657600080fd5b610125600160a060020a0360043516610996565b34156103d557600080fd5b61013a610a05565b34156103e857600080fd5b610360610a1b565b34156103fb57600080fd5b6101f1600160a060020a03600480358216916024803590911691604435916084906064359081019083013580602081810201604051908101604052809392919081815260200183836020028082843750949650610a2a95505050505050565b341561046557600080fd5b61036060046024813581810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610ad095505050505050565b34156104b657600080fd5b6101f1600160a060020a036004803582169160248035909116916044359160849060643590810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610bac95505050505050565b610542838383600060405180591061052c5750595b90808252806020026020018201604052506105af565b505050565b6040517f4352454154455f5045524d495353494f4e535f524f4c450000000000000000008152601701604051809103902081565b6040517f65766d7265672e617261676f6e706d2e657468000000000000000000000000008152601301604051809103902081565b600083836105bd828261090d565b600160a060020a031633600160a060020a03161415156105dc57600080fd5b6105e7878787610632565b156105f157600080fd5b6000845111610612576000604051908152602001604051809103902061061b565b61061b84610be5565b925061062987878786610d3a565b50505050505050565b600061063c6115bd565b600060405180591061064b5750595b9080825280602002602001820160405250905061066a85858584610a2a565b95945050505050565b60656020528160005260406000208181548110151561068e57fe5b60009182526020909120015460ff80821693506101008204169150620100009004600160f060020a031683565b60015481565b6003545b90565b6040517f6170700000000000000000000000000000000000000000000000000000000000815260030160405180910390206040517f65766d7265672e617261676f6e706d2e6574680000000000000000000000000081526013016040518091039020604051918252602082015260409081019051809103902081565b8181610750828261090d565b600160a060020a031633600160a060020a031614151561076f57600080fd5b61077a858585610632565b151561078557600080fd5b6107928585856000610d3a565b5050505050565b60006107a36115bd565b600080845111156107bc57835160200290508391508082525b600054600160a060020a031615806108cd575060008054600160a060020a03169063fdef91069088903090899087906040516020015260405160e060020a63ffffffff8716028152600160a060020a0380861660048301908152908516602483015260448201849052608060648301908152909160840183818151815260200191508051906020019080838360005b8381101561086357808201518382015260200161084b565b50505050905090810190601f1680156108905780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b15156108b157600080fd5b6102c65a03f115156108c257600080fd5b505050604051805190505b9695505050505050565b81816108e3828261090d565b600160a060020a031633600160a060020a031614151561090257600080fd5b610792858585610daf565b60006066600061091d8585610e31565b8152602081019190915260400160002054600160a060020a03169392505050565b61097933306040517f4352454154455f5045524d495353494f4e535f524f4c4500000000000000000081526017016040518091039020610632565b151561098457600080fd5b61099084848484610e75565b50505050565b600354156109a357600080fd5b6109ab610ebd565b60005433600160a060020a039081169116146109c657600080fd5b610a0281306040517f4352454154455f5045524d495353494f4e535f524f4c450000000000000000008152601701604051809103902084610e75565b50565b6000604051908152602001604051809103902081565b600054600160a060020a031681565b600080600060646000610a3e898989610ed7565b815260208101919091526040016000205491508115801590610a685750610a688288888888610f28565b15610a765760019250610ac6565b60646000610a876000198989610ed7565b815260208101919091526040016000205490508015801590610ab35750610ab381600019888888610f28565b15610ac15760019250610ac6565b600092505b5050949350505050565b6000610ada610f5b565b600160a060020a03166304bf2a7f836000604051602001526040518263ffffffff1660e060020a0281526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610b41578082015183820152602001610b29565b50505050905090810190601f168015610b6e5780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b1515610b8c57600080fd5b6102c65a03f11515610b9d57600080fd5b50505060405180519392505050565b6000610bb66115bd565b600060208451811515610bc557fe5b049050839150808252610bda87878785610a2a565b979650505050505050565b6000806000806000610bf56115cf565b8660405180828051906020019060200280838360005b83811015610c23578082015183820152602001610c0b565b505050509050019150506040519081900390206000818152606560205260409020805491965094501515610d2f57600092505b8651831015610d2f57868381518110610c6b57fe5b906020019060200201519150606060405190810160405280610c8c8461104b565b60ff168152602001610c9d84611071565b60ff16815260200183600160f060020a03168152509050838054806001018281610cc791906115ef565b600092835260209092208391018151815460ff191660ff919091161781556020820151815460ff919091166101000261ff001990911617815560408201518154600160f060020a0391909116620100000261ffff909116179055505060019290920191610c56565b509295945050505050565b8060646000610d4a878787610ed7565b815260208101919091526040908101600020919091558290600160a060020a0380861691908716907f759b9a74d5354b5801710a0c1b283cc9f0d32b607ac8ced10c83ac8e75c77d52908515159051901515815260200160405180910390a450505050565b8260666000610dbe8585610e31565b815260208101919091526040908101600020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03938416179055848216918391908516907ff3addc8b8e25ee11528a61b0e65092cae0666ef0ec0c64cb303993c88d689b4d905160405180910390a4505050565b600060018383604051928352600160a060020a03919091166c0100000000000000000000000002602083015260348201526054016040518091039020905092915050565b6000610e81848461090d565b600160a060020a031614610e9457600080fd5b610eb284848460006040519081526020016040518091039020610d3a565b610990818484610daf565b60035415610eca57600080fd5b610ed2611096565b600355565b600060028484846040519384526c01000000000000000000000000600160a060020a0393841681026020860152919092160260348301526048820152606801604051809103902090505b9392505050565b600080604051908152602001604051908190039020861415610f4c5750600161066a565b6108cd8660008787878761109a565b600080548190600160a060020a03166342c71f1d6040517f6170700000000000000000000000000000000000000000000000000000000000815260030160405180910390206040517f65766d7265672e617261676f6e706d2e6574680000000000000000000000000081526013016040518091039020604051918252602082015260409081019051809103902060006040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b151561102757600080fd5b6102c65a03f1151561103857600080fd5b50505060405180519250829150505b5090565b7f0100000000000000000000000000000000000000000000000000000000000000900490565b7e01000000000000000000000000000000000000000000000000000000000000900490565b4390565b60006110a46115cf565b600088815260656020526040812054819063ffffffff8a16106110ca5760009350611320565b60008a8152606560205260409020805463ffffffff8b169081106110ea57fe5b906000526020600020900160606040519081016040908152915460ff80821683526101008204166020830152620100009004600160f060020a031691810191909152925060cc835160ff16141561115057611149838b8a8a8a8a61132d565b9350611320565b8260400151600160f060020a0316905060cb835160ff161415611212578260400151600160a060020a0316631a2b625089898960006040516020015260405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b15156111db57600080fd5b6102c65a03f115156111ec57600080fd5b50505060405180519050611201576000611204565b60015b60ff169150600190506112cf565b60c8835160ff16141561122e57611227611096565b91506112cf565b60c9835160ff161415611254576112436114e3565b67ffffffffffffffff1691506112cf565b60ca835160ff1614156112725733600160a060020a031691506112cf565b60cd835160ff161415611294578260400151600160f060020a031691506112cf565b8451835160ff16106112a95760009350611320565b84835160ff16815181106112b957fe5b90602001906020020151600160f060020a031691505b600c836020015160ff16600c8111156112e457fe5b600c8111156112ef57fe5b141561130057600082119350611320565b61131d82846020015160ff16600c81111561131757fe5b836114e7565b93505b5050509695505050505050565b60008080808080808080600b8f6020015160ff16600c81111561134c57fe5b600c81111561135757fe5b14156113aa576113738f60400151600160f060020a03166115a4565b9750975097506113878e898f8f8f8f61109a565b94506113a38e86611398578761139a565b885b8f8f8f8f61109a565b98506114d1565b6113c08f60400151600160f060020a03166115a4565b50935093506113d38e858f8f8f8f61109a565b915060078f6020015160ff16600c8111156113ea57fe5b600c8111156113f557fe5b141561140457811598506114d1565b81801561142e575060098f6020015160ff16600c81111561142157fe5b600c81111561142c57fe5b145b1561143c57600198506114d1565b81158015611467575060088f6020015160ff16600c81111561145a57fe5b600c81111561146557fe5b145b1561147557600098506114d1565b6114838e848f8f8f8f61109a565b9050600a8f6020015160ff16600c81111561149a57fe5b600c8111156114a557fe5b14156114cd578180156114b6575080155b806113a35750811580156113a357508098506114d1565b8098505b50505050505050509695505050505050565b4290565b6000600183600c8111156114f757fe5b14156115065750828114610f21565b600283600c81111561151457fe5b1415611524575082811415610f21565b600383600c81111561153257fe5b14156115415750808311610f21565b600483600c81111561154f57fe5b141561155e5750808310610f21565b600583600c81111561156c57fe5b141561157c575080831015610f21565b600683600c81111561158a57fe5b141561159a575080831115610f21565b5060009392505050565b9064010000000082049068010000000000000000830490565b60206040519081016040526000815290565b606060405190810160409081526000808352602083018190529082015290565b815481835581811511610542576000838152602090206105429181019083016106c591905b8082111561104757600081556001016116145600a165627a7a7230582089c09ffb3fa50aa1837c9d9b584cb81ab60623cac8c1b2d7cbf86fcdf52cb6000029

Deployed Bytecode

0x6060604052600436106100f85763ffffffff60e060020a6000350416630a8ed3db81146100fd5780633d6ab68f1461012757806360b1e0571461014c5780636815c9921461015f5780636d6712d8146101c9578063710a83151461020557806380afdea8146102525780638b3dd749146102655780639b3fdf4c146102785780639d0effdb1461028b578063a1658fad146102b3578063afd925df14610316578063b19057271461033e578063be0384781461037c578063c4d66de8146103ab578063c513f66e146103ca578063d4aae0c4146103dd578063f520b58d146103f0578063f92a79ff1461045a578063fdef9106146104ab575b600080fd5b341561010857600080fd5b610125600160a060020a0360043581169060243516604435610517565b005b341561013257600080fd5b61013a610547565b60405190815260200160405180910390f35b341561015757600080fd5b61013a61057b565b341561016a57600080fd5b610125600160a060020a036004803582169160248035909116916044359160849060643590810190830135806020818102016040519081016040528093929190818152602001838360200280828437509496506105af95505050505050565b34156101d457600080fd5b6101f1600160a060020a0360043581169060243516604435610632565b604051901515815260200160405180910390f35b341561021057600080fd5b61021e600435602435610673565b60405160ff9384168152919092166020820152600160f060020a039091166040808301919091526060909101905180910390f35b341561025d57600080fd5b61013a6106bb565b341561027057600080fd5b61013a6106c1565b341561028357600080fd5b61013a6106c8565b341561029657600080fd5b610125600160a060020a0360043581169060243516604435610744565b34156102be57600080fd5b6101f160048035600160a060020a031690602480359190606490604435908101908301358060208082020160405190810160405280939291908181526020018383602002808284375094965061079995505050505050565b341561032157600080fd5b610125600160a060020a03600435811690602435166044356108d7565b341561034957600080fd5b610360600160a060020a036004351660243561090d565b604051600160a060020a03909116815260200160405180910390f35b341561038757600080fd5b610125600160a060020a03600435811690602435811690604435906064351661093e565b34156103b657600080fd5b610125600160a060020a0360043516610996565b34156103d557600080fd5b61013a610a05565b34156103e857600080fd5b610360610a1b565b34156103fb57600080fd5b6101f1600160a060020a03600480358216916024803590911691604435916084906064359081019083013580602081810201604051908101604052809392919081815260200183836020028082843750949650610a2a95505050505050565b341561046557600080fd5b61036060046024813581810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610ad095505050505050565b34156104b657600080fd5b6101f1600160a060020a036004803582169160248035909116916044359160849060643590810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610bac95505050505050565b610542838383600060405180591061052c5750595b90808252806020026020018201604052506105af565b505050565b6040517f4352454154455f5045524d495353494f4e535f524f4c450000000000000000008152601701604051809103902081565b6040517f65766d7265672e617261676f6e706d2e657468000000000000000000000000008152601301604051809103902081565b600083836105bd828261090d565b600160a060020a031633600160a060020a03161415156105dc57600080fd5b6105e7878787610632565b156105f157600080fd5b6000845111610612576000604051908152602001604051809103902061061b565b61061b84610be5565b925061062987878786610d3a565b50505050505050565b600061063c6115bd565b600060405180591061064b5750595b9080825280602002602001820160405250905061066a85858584610a2a565b95945050505050565b60656020528160005260406000208181548110151561068e57fe5b60009182526020909120015460ff80821693506101008204169150620100009004600160f060020a031683565b60015481565b6003545b90565b6040517f6170700000000000000000000000000000000000000000000000000000000000815260030160405180910390206040517f65766d7265672e617261676f6e706d2e6574680000000000000000000000000081526013016040518091039020604051918252602082015260409081019051809103902081565b8181610750828261090d565b600160a060020a031633600160a060020a031614151561076f57600080fd5b61077a858585610632565b151561078557600080fd5b6107928585856000610d3a565b5050505050565b60006107a36115bd565b600080845111156107bc57835160200290508391508082525b600054600160a060020a031615806108cd575060008054600160a060020a03169063fdef91069088903090899087906040516020015260405160e060020a63ffffffff8716028152600160a060020a0380861660048301908152908516602483015260448201849052608060648301908152909160840183818151815260200191508051906020019080838360005b8381101561086357808201518382015260200161084b565b50505050905090810190601f1680156108905780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b15156108b157600080fd5b6102c65a03f115156108c257600080fd5b505050604051805190505b9695505050505050565b81816108e3828261090d565b600160a060020a031633600160a060020a031614151561090257600080fd5b610792858585610daf565b60006066600061091d8585610e31565b8152602081019190915260400160002054600160a060020a03169392505050565b61097933306040517f4352454154455f5045524d495353494f4e535f524f4c4500000000000000000081526017016040518091039020610632565b151561098457600080fd5b61099084848484610e75565b50505050565b600354156109a357600080fd5b6109ab610ebd565b60005433600160a060020a039081169116146109c657600080fd5b610a0281306040517f4352454154455f5045524d495353494f4e535f524f4c450000000000000000008152601701604051809103902084610e75565b50565b6000604051908152602001604051809103902081565b600054600160a060020a031681565b600080600060646000610a3e898989610ed7565b815260208101919091526040016000205491508115801590610a685750610a688288888888610f28565b15610a765760019250610ac6565b60646000610a876000198989610ed7565b815260208101919091526040016000205490508015801590610ab35750610ab381600019888888610f28565b15610ac15760019250610ac6565b600092505b5050949350505050565b6000610ada610f5b565b600160a060020a03166304bf2a7f836000604051602001526040518263ffffffff1660e060020a0281526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610b41578082015183820152602001610b29565b50505050905090810190601f168015610b6e5780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b1515610b8c57600080fd5b6102c65a03f11515610b9d57600080fd5b50505060405180519392505050565b6000610bb66115bd565b600060208451811515610bc557fe5b049050839150808252610bda87878785610a2a565b979650505050505050565b6000806000806000610bf56115cf565b8660405180828051906020019060200280838360005b83811015610c23578082015183820152602001610c0b565b505050509050019150506040519081900390206000818152606560205260409020805491965094501515610d2f57600092505b8651831015610d2f57868381518110610c6b57fe5b906020019060200201519150606060405190810160405280610c8c8461104b565b60ff168152602001610c9d84611071565b60ff16815260200183600160f060020a03168152509050838054806001018281610cc791906115ef565b600092835260209092208391018151815460ff191660ff919091161781556020820151815460ff919091166101000261ff001990911617815560408201518154600160f060020a0391909116620100000261ffff909116179055505060019290920191610c56565b509295945050505050565b8060646000610d4a878787610ed7565b815260208101919091526040908101600020919091558290600160a060020a0380861691908716907f759b9a74d5354b5801710a0c1b283cc9f0d32b607ac8ced10c83ac8e75c77d52908515159051901515815260200160405180910390a450505050565b8260666000610dbe8585610e31565b815260208101919091526040908101600020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03938416179055848216918391908516907ff3addc8b8e25ee11528a61b0e65092cae0666ef0ec0c64cb303993c88d689b4d905160405180910390a4505050565b600060018383604051928352600160a060020a03919091166c0100000000000000000000000002602083015260348201526054016040518091039020905092915050565b6000610e81848461090d565b600160a060020a031614610e9457600080fd5b610eb284848460006040519081526020016040518091039020610d3a565b610990818484610daf565b60035415610eca57600080fd5b610ed2611096565b600355565b600060028484846040519384526c01000000000000000000000000600160a060020a0393841681026020860152919092160260348301526048820152606801604051809103902090505b9392505050565b600080604051908152602001604051908190039020861415610f4c5750600161066a565b6108cd8660008787878761109a565b600080548190600160a060020a03166342c71f1d6040517f6170700000000000000000000000000000000000000000000000000000000000815260030160405180910390206040517f65766d7265672e617261676f6e706d2e6574680000000000000000000000000081526013016040518091039020604051918252602082015260409081019051809103902060006040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b151561102757600080fd5b6102c65a03f1151561103857600080fd5b50505060405180519250829150505b5090565b7f0100000000000000000000000000000000000000000000000000000000000000900490565b7e01000000000000000000000000000000000000000000000000000000000000900490565b4390565b60006110a46115cf565b600088815260656020526040812054819063ffffffff8a16106110ca5760009350611320565b60008a8152606560205260409020805463ffffffff8b169081106110ea57fe5b906000526020600020900160606040519081016040908152915460ff80821683526101008204166020830152620100009004600160f060020a031691810191909152925060cc835160ff16141561115057611149838b8a8a8a8a61132d565b9350611320565b8260400151600160f060020a0316905060cb835160ff161415611212578260400151600160a060020a0316631a2b625089898960006040516020015260405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b15156111db57600080fd5b6102c65a03f115156111ec57600080fd5b50505060405180519050611201576000611204565b60015b60ff169150600190506112cf565b60c8835160ff16141561122e57611227611096565b91506112cf565b60c9835160ff161415611254576112436114e3565b67ffffffffffffffff1691506112cf565b60ca835160ff1614156112725733600160a060020a031691506112cf565b60cd835160ff161415611294578260400151600160f060020a031691506112cf565b8451835160ff16106112a95760009350611320565b84835160ff16815181106112b957fe5b90602001906020020151600160f060020a031691505b600c836020015160ff16600c8111156112e457fe5b600c8111156112ef57fe5b141561130057600082119350611320565b61131d82846020015160ff16600c81111561131757fe5b836114e7565b93505b5050509695505050505050565b60008080808080808080600b8f6020015160ff16600c81111561134c57fe5b600c81111561135757fe5b14156113aa576113738f60400151600160f060020a03166115a4565b9750975097506113878e898f8f8f8f61109a565b94506113a38e86611398578761139a565b885b8f8f8f8f61109a565b98506114d1565b6113c08f60400151600160f060020a03166115a4565b50935093506113d38e858f8f8f8f61109a565b915060078f6020015160ff16600c8111156113ea57fe5b600c8111156113f557fe5b141561140457811598506114d1565b81801561142e575060098f6020015160ff16600c81111561142157fe5b600c81111561142c57fe5b145b1561143c57600198506114d1565b81158015611467575060088f6020015160ff16600c81111561145a57fe5b600c81111561146557fe5b145b1561147557600098506114d1565b6114838e848f8f8f8f61109a565b9050600a8f6020015160ff16600c81111561149a57fe5b600c8111156114a557fe5b14156114cd578180156114b6575080155b806113a35750811580156113a357508098506114d1565b8098505b50505050505050509695505050505050565b4290565b6000600183600c8111156114f757fe5b14156115065750828114610f21565b600283600c81111561151457fe5b1415611524575082811415610f21565b600383600c81111561153257fe5b14156115415750808311610f21565b600483600c81111561154f57fe5b141561155e5750808310610f21565b600583600c81111561156c57fe5b141561157c575080831015610f21565b600683600c81111561158a57fe5b141561159a575080831115610f21565b5060009392505050565b9064010000000082049068010000000000000000830490565b60206040519081016040526000815290565b606060405190810160409081526000808352602083018190529082015290565b815481835581811511610542576000838152602090206105429181019083016106c591905b8082111561104757600081556001016116145600a165627a7a7230582089c09ffb3fa50aa1837c9d9b584cb81ab60623cac8c1b2d7cbf86fcdf52cb6000029

Swarm Source

bzzr://89c09ffb3fa50aa1837c9d9b584cb81ab60623cac8c1b2d7cbf86fcdf52cb600

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.