More Info
Private Name Tags
ContractCreator
Multichain Info
No addresses found
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
31222929 | 508 days ago | Contract Creation | 0 xDAI |
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
Roles
Compiler Version
v0.8.21+commit.d9974bed
Optimization Enabled:
Yes with 100 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.8.17 <0.9.0; import "./AllowanceTracker.sol"; import "./PermissionBuilder.sol"; import "./PermissionChecker.sol"; import "./PermissionLoader.sol"; /** * @title Zodiac Roles Mod - granular, role-based, access control for your * on-chain avatar accounts (like Safe). * @author Cristóvão Honorato - <[email protected]> * @author Jan-Felix Schwarz - <[email protected]> * @author Auryn Macmillan - <[email protected]> * @author Nathan Ginnever - <[email protected]> */ contract Roles is Modifier, AllowanceTracker, PermissionBuilder, PermissionChecker, PermissionLoader { mapping(address => bytes32) public defaultRoles; event AssignRoles(address module, bytes32[] roleKeys, bool[] memberOf); event RolesModSetup( address indexed initiator, address indexed owner, address indexed avatar, address target ); event SetDefaultRole(address module, bytes32 defaultRoleKey); error ArraysDifferentLength(); /// Sender is allowed to make this call, but the internal transaction failed error ModuleTransactionFailed(); /// @param _owner Address of the owner /// @param _avatar Address of the avatar (e.g. a Gnosis Safe) /// @param _target Address of the contract that will call exec function constructor(address _owner, address _avatar, address _target) { bytes memory initParams = abi.encode(_owner, _avatar, _target); setUp(initParams); } /// @dev There is no zero address check as solidty will check for /// missing arguments and the space of invalid addresses is too large /// to check. Invalid avatar or target address can be reset by owner. function setUp(bytes memory initParams) public override initializer { (address _owner, address _avatar, address _target) = abi.decode( initParams, (address, address, address) ); _transferOwnership(_owner); avatar = _avatar; target = _target; setupModules(); emit RolesModSetup(msg.sender, _owner, _avatar, _target); } /// @dev Assigns and revokes roles to a given module. /// @param module Module on which to assign/revoke roles. /// @param roleKeys Roles to assign/revoke. /// @param memberOf Assign (true) or revoke (false) corresponding roleKeys. function assignRoles( address module, bytes32[] calldata roleKeys, bool[] calldata memberOf ) external onlyOwner { if (roleKeys.length != memberOf.length) { revert ArraysDifferentLength(); } for (uint16 i; i < roleKeys.length; ++i) { roles[roleKeys[i]].members[module] = memberOf[i]; } if (!isModuleEnabled(module)) { enableModule(module); } emit AssignRoles(module, roleKeys, memberOf); } /// @dev Sets the default role used for a module if it calls execTransactionFromModule() or execTransactionFromModuleReturnData(). /// @param module Address of the module on which to set default role. /// @param roleKey Role to be set as default. function setDefaultRole( address module, bytes32 roleKey ) external onlyOwner { defaultRoles[module] = roleKey; emit SetDefaultRole(module, roleKey); } /// @dev Passes a transaction to the modifier. /// @param to Destination address of module transaction /// @param value Ether value of module transaction /// @param data Data payload of module transaction /// @param operation Operation type of module transaction /// @notice Can only be called by enabled modules function execTransactionFromModule( address to, uint256 value, bytes calldata data, Enum.Operation operation ) public override returns (bool success) { Consumption[] memory consumptions = _authorize( defaultRoles[msg.sender], to, value, data, operation ); _flushPrepare(consumptions); success = exec(to, value, data, operation); _flushCommit(consumptions, success); } /// @dev Passes a transaction to the modifier, expects return data. /// @param to Destination address of module transaction /// @param value Ether value of module transaction /// @param data Data payload of module transaction /// @param operation Operation type of module transaction /// @notice Can only be called by enabled modules function execTransactionFromModuleReturnData( address to, uint256 value, bytes calldata data, Enum.Operation operation ) public override returns (bool success, bytes memory returnData) { Consumption[] memory consumptions = _authorize( defaultRoles[msg.sender], to, value, data, operation ); _flushPrepare(consumptions); (success, returnData) = execAndReturnData(to, value, data, operation); _flushCommit(consumptions, success); } /// @dev Passes a transaction to the modifier assuming the specified role. /// @param to Destination address of module transaction /// @param value Ether value of module transaction /// @param data Data payload of module transaction /// @param operation Operation type of module transaction /// @param roleKey Identifier of the role to assume for this transaction /// @param shouldRevert Should the function revert on inner execution returning success false? /// @notice Can only be called by enabled modules function execTransactionWithRole( address to, uint256 value, bytes calldata data, Enum.Operation operation, bytes32 roleKey, bool shouldRevert ) public returns (bool success) { Consumption[] memory consumptions = _authorize( roleKey, to, value, data, operation ); _flushPrepare(consumptions); success = exec(to, value, data, operation); if (shouldRevert && !success) { revert ModuleTransactionFailed(); } _flushCommit(consumptions, success); } /// @dev Passes a transaction to the modifier assuming the specified role. Expects return data. /// @param to Destination address of module transaction /// @param value Ether value of module transaction /// @param data Data payload of module transaction /// @param operation Operation type of module transaction /// @param roleKey Identifier of the role to assume for this transaction /// @param shouldRevert Should the function revert on inner execution returning success false? /// @notice Can only be called by enabled modules function execTransactionWithRoleReturnData( address to, uint256 value, bytes calldata data, Enum.Operation operation, bytes32 roleKey, bool shouldRevert ) public returns (bool success, bytes memory returnData) { Consumption[] memory consumptions = _authorize( roleKey, to, value, data, operation ); _flushPrepare(consumptions); (success, returnData) = execAndReturnData(to, value, data, operation); if (shouldRevert && !success) { revert ModuleTransactionFailed(); } _flushCommit(consumptions, success); } }
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.7.0 <0.9.0; /// @title Enum - Collection of enums /// @author Richard Meissner - <[email protected]> contract Enum { enum Operation {Call, DelegateCall} }
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.7.0 <0.9.0; import {Enum} from "@gnosis.pm/safe-contracts/contracts/common/Enum.sol"; import {ExecutionTracker} from "../signature/ExecutionTracker.sol"; import {IAvatar} from "../interfaces/IAvatar.sol"; import {Module} from "./Module.sol"; import {SignatureChecker} from "../signature/SignatureChecker.sol"; /// @title Modifier Interface - A contract that sits between a Module and an Avatar and enforce some additional logic. abstract contract Modifier is Module, ExecutionTracker, SignatureChecker, IAvatar { address internal constant SENTINEL_MODULES = address(0x1); /// Mapping of modules. mapping(address => address) internal modules; /// `sender` is not an authorized module. /// @param sender The address of the sender. error NotAuthorized(address sender); /// `module` is invalid. error InvalidModule(address module); /// `pageSize` is invalid. error InvalidPageSize(); /// `module` is already disabled. error AlreadyDisabledModule(address module); /// `module` is already enabled. error AlreadyEnabledModule(address module); /// @dev `setModules()` was already called. error SetupModulesAlreadyCalled(); /* -------------------------------------------------- You must override both of the following virtual functions, execTransactionFromModule() and execTransactionFromModuleReturnData(). It is recommended that implementations of both functions make use the onlyModule modifier. */ /// @dev Passes a transaction to the modifier. /// @notice Can only be called by enabled modules. /// @param to Destination address of module transaction. /// @param value Ether value of module transaction. /// @param data Data payload of module transaction. /// @param operation Operation type of module transaction. function execTransactionFromModule( address to, uint256 value, bytes calldata data, Enum.Operation operation ) public virtual returns (bool success); /// @dev Passes a transaction to the modifier, expects return data. /// @notice Can only be called by enabled modules. /// @param to Destination address of module transaction. /// @param value Ether value of module transaction. /// @param data Data payload of module transaction. /// @param operation Operation type of module transaction. function execTransactionFromModuleReturnData( address to, uint256 value, bytes calldata data, Enum.Operation operation ) public virtual returns (bool success, bytes memory returnData); /* -------------------------------------------------- */ modifier moduleOnly() { if (modules[msg.sender] == address(0)) { (bytes32 hash, address signer) = moduleTxSignedBy(); // is the signer a module? if (modules[signer] == address(0)) { revert NotAuthorized(msg.sender); } // is the provided signature fresh? if (consumed[signer][hash]) { revert HashAlreadyConsumed(hash); } consumed[signer][hash] = true; emit HashExecuted(hash); } _; } function sentOrSignedByModule() internal view returns (address) { if (modules[msg.sender] != address(0)) { return msg.sender; } (, address signer) = moduleTxSignedBy(); if (modules[signer] != address(0)) { return signer; } return address(0); } /// @dev Disables a module on the modifier. /// @notice This can only be called by the owner. /// @param prevModule Module that pointed to the module to be removed in the linked list. /// @param module Module to be removed. function disableModule( address prevModule, address module ) public override onlyOwner { if (module == address(0) || module == SENTINEL_MODULES) revert InvalidModule(module); if (modules[prevModule] != module) revert AlreadyDisabledModule(module); modules[prevModule] = modules[module]; modules[module] = address(0); emit DisabledModule(module); } /// @dev Enables a module that can add transactions to the queue /// @param module Address of the module to be enabled /// @notice This can only be called by the owner function enableModule(address module) public override onlyOwner { if (module == address(0) || module == SENTINEL_MODULES) revert InvalidModule(module); if (modules[module] != address(0)) revert AlreadyEnabledModule(module); modules[module] = modules[SENTINEL_MODULES]; modules[SENTINEL_MODULES] = module; emit EnabledModule(module); } /// @dev Returns if an module is enabled /// @return True if the module is enabled function isModuleEnabled( address _module ) public view override returns (bool) { return SENTINEL_MODULES != _module && modules[_module] != address(0); } /// @dev Returns array of modules. /// If all entries fit into a single page, the next pointer will be 0x1. /// If another page is present, next will be the last element of the returned array. /// @param start Start of the page. Has to be a module or start pointer (0x1 address) /// @param pageSize Maximum number of modules that should be returned. Has to be > 0 /// @return array Array of modules. /// @return next Start of the next page. function getModulesPaginated( address start, uint256 pageSize ) external view override returns (address[] memory array, address next) { if (start != SENTINEL_MODULES && !isModuleEnabled(start)) { revert InvalidModule(start); } if (pageSize == 0) { revert InvalidPageSize(); } // Init array with max page size array = new address[](pageSize); // Populate return array uint256 moduleCount = 0; next = modules[start]; while ( next != address(0) && next != SENTINEL_MODULES && moduleCount < pageSize ) { array[moduleCount] = next; next = modules[next]; moduleCount++; } // Because of the argument validation we can assume that // the `currentModule` will always be either a module address // or sentinel address (aka the end). If we haven't reached the end // inside the loop, we need to set the next pointer to the last element // because it skipped over to the next module which is neither included // in the current page nor won't be included in the next one // if you pass it as a start. if (next != SENTINEL_MODULES) { next = array[moduleCount - 1]; } // Set correct size of returned array // solhint-disable-next-line no-inline-assembly assembly { mstore(array, moduleCount) } } /// @dev Initializes the modules linked list. /// @notice Should be called as part of the `setUp` / initializing function and can only be called once. function setupModules() internal { if (modules[SENTINEL_MODULES] != address(0)) revert SetupModulesAlreadyCalled(); modules[SENTINEL_MODULES] = SENTINEL_MODULES; } }
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.7.0 <0.9.0; import {Enum} from "@gnosis.pm/safe-contracts/contracts/common/Enum.sol"; import {FactoryFriendly} from "../factory/FactoryFriendly.sol"; import {IAvatar} from "../interfaces/IAvatar.sol"; /// @title Module Interface - A contract that can pass messages to a Module Manager contract if enabled by that contract. abstract contract Module is FactoryFriendly { /// @dev Address that will ultimately execute function calls. address public avatar; /// @dev Address that this module will pass transactions to. address public target; /// @dev Emitted each time the avatar is set. event AvatarSet(address indexed previousAvatar, address indexed newAvatar); /// @dev Emitted each time the Target is set. event TargetSet(address indexed previousTarget, address indexed newTarget); /// @dev Sets the avatar to a new avatar (`newAvatar`). /// @notice Can only be called by the current owner. function setAvatar(address _avatar) public onlyOwner { address previousAvatar = avatar; avatar = _avatar; emit AvatarSet(previousAvatar, _avatar); } /// @dev Sets the target to a new target (`newTarget`). /// @notice Can only be called by the current owner. function setTarget(address _target) public onlyOwner { address previousTarget = target; target = _target; emit TargetSet(previousTarget, _target); } /// @dev Passes a transaction to be executed by the avatar. /// @notice Can only be called by this contract. /// @param to Destination address of module transaction. /// @param value Ether value of module transaction. /// @param data Data payload of module transaction. /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call. function exec( address to, uint256 value, bytes memory data, Enum.Operation operation ) internal virtual returns (bool success) { return IAvatar(target).execTransactionFromModule(to, value, data, operation); } /// @dev Passes a transaction to be executed by the target and returns data. /// @notice Can only be called by this contract. /// @param to Destination address of module transaction. /// @param value Ether value of module transaction. /// @param data Data payload of module transaction. /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call. function execAndReturnData( address to, uint256 value, bytes memory data, Enum.Operation operation ) internal virtual returns (bool success, bytes memory returnData) { return IAvatar(target).execTransactionFromModuleReturnData( to, value, data, operation ); } }
// SPDX-License-Identifier: LGPL-3.0-only /// @title Zodiac FactoryFriendly - A contract that allows other contracts to be initializable and pass bytes as arguments to define contract state pragma solidity >=0.7.0 <0.9.0; import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; abstract contract FactoryFriendly is OwnableUpgradeable { function setUp(bytes memory initializeParams) public virtual; }
// SPDX-License-Identifier: LGPL-3.0-only /// @title Zodiac Avatar - A contract that manages modules that can execute transactions via this contract. pragma solidity >=0.7.0 <0.9.0; import {Enum} from "@gnosis.pm/safe-contracts/contracts/common/Enum.sol"; interface IAvatar { event EnabledModule(address module); event DisabledModule(address module); event ExecutionFromModuleSuccess(address indexed module); event ExecutionFromModuleFailure(address indexed module); /// @dev Enables a module on the avatar. /// @notice Can only be called by the avatar. /// @notice Modules should be stored as a linked list. /// @notice Must emit EnabledModule(address module) if successful. /// @param module Module to be enabled. function enableModule(address module) external; /// @dev Disables a module on the avatar. /// @notice Can only be called by the avatar. /// @notice Must emit DisabledModule(address module) if successful. /// @param prevModule Address that pointed to the module to be removed in the linked list /// @param module Module to be removed. function disableModule(address prevModule, address module) external; /// @dev Allows a Module to execute a transaction. /// @notice Can only be called by an enabled module. /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful. /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful. /// @param to Destination address of module transaction. /// @param value Ether value of module transaction. /// @param data Data payload of module transaction. /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call. function execTransactionFromModule( address to, uint256 value, bytes memory data, Enum.Operation operation ) external returns (bool success); /// @dev Allows a Module to execute a transaction and return data /// @notice Can only be called by an enabled module. /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful. /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful. /// @param to Destination address of module transaction. /// @param value Ether value of module transaction. /// @param data Data payload of module transaction. /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call. function execTransactionFromModuleReturnData( address to, uint256 value, bytes memory data, Enum.Operation operation ) external returns (bool success, bytes memory returnData); /// @dev Returns if an module is enabled /// @return True if the module is enabled function isModuleEnabled(address module) external view returns (bool); /// @dev Returns array of modules. /// @param start Start of the page. /// @param pageSize Maximum number of modules that should be returned. /// @return array Array of modules. /// @return next Start of the next page. function getModulesPaginated( address start, uint256 pageSize ) external view returns (address[] memory array, address next); }
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.8.0 <0.9.0; /// @title ExecutionTracker - A contract that keeps track of executed and invalidated hashes contract ExecutionTracker { error HashAlreadyConsumed(bytes32); event HashExecuted(bytes32); event HashInvalidated(bytes32); mapping(address => mapping(bytes32 => bool)) public consumed; function invalidate(bytes32 hash) external { consumed[msg.sender][hash] = true; emit HashInvalidated(hash); } }
// SPDX-License-Identifier: LGPL-3.0-only /* solhint-disable one-contract-per-file */ pragma solidity >=0.7.0 <0.9.0; interface IERC1271 { /** * @notice EIP1271 method to validate a signature. * @param hash Hash of the data signed on the behalf of address(this). * @param signature Signature byte array associated with _data. * * MUST return the bytes4 magic value 0x1626ba7e when function passes. * MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5) * MUST allow external calls */ function isValidSignature( bytes32 hash, bytes memory signature ) external view returns (bytes4); }
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.8.0 <0.9.0; import {IERC1271} from "./IERC1271.sol"; /// @title SignatureChecker - A contract that retrieves and validates signatures appended to transaction calldata. /// @dev currently supports eip-712 and eip-1271 signatures abstract contract SignatureChecker { /** * @notice Searches for a signature, validates it, and returns the signer's address. * @dev When signature not found or invalid, zero address is returned * @return The address of the signer. */ function moduleTxSignedBy() internal view returns (bytes32, address) { bytes calldata data = msg.data; /* * The idea is to extend `onlyModule` and provide signature checking * without code changes to inheriting contracts (Modifiers). * * Since it's a generic mechanism, there is no way to conclusively * identify the trailing bytes as a signature. We simply slice those * and recover signer. * * As a result, we impose a minimum calldata length equal to a function * selector plus salt, plus a signature (i.e., 4 + 32 + 65 bytes), any * shorter and calldata it guaranteed to not contain a signature. */ if (data.length < 4 + 32 + 65) { return (bytes32(0), address(0)); } (uint8 v, bytes32 r, bytes32 s) = _splitSignature(data); uint256 end = data.length - (32 + 65); bytes32 salt = bytes32(data[end:]); /* * When handling contract signatures: * v - is zero * r - contains the signer * s - contains the offset within calldata where the signer specific * signature is located * * We detect contract signatures by checking: * 1- `v` is zero * 2- `s` points within the buffer, is after selector, is before * salt and delimits a non-zero length buffer */ if (v == 0) { uint256 start = uint256(s); if (start < 4 || start > end) { return (bytes32(0), address(0)); } address signer = address(uint160(uint256(r))); bytes32 hash = moduleTxHash(data[:start], salt); return _isValidContractSignature(signer, hash, data[start:end]) ? (hash, signer) : (bytes32(0), address(0)); } else { bytes32 hash = moduleTxHash(data[:end], salt); return (hash, ecrecover(hash, v, r, s)); } } /** * @notice Hashes the transaction EIP-712 data structure. * @dev The produced hash is intended to be signed. * @param data The current transaction's calldata. * @param salt The salt value. * @return The 32-byte hash that is to be signed. */ function moduleTxHash( bytes calldata data, bytes32 salt ) public view returns (bytes32) { bytes32 domainSeparator = keccak256( abi.encode(DOMAIN_SEPARATOR_TYPEHASH, block.chainid, this) ); bytes memory moduleTxData = abi.encodePacked( bytes1(0x19), bytes1(0x01), domainSeparator, keccak256(abi.encode(MODULE_TX_TYPEHASH, keccak256(data), salt)) ); return keccak256(moduleTxData); } /** * @dev Extracts signature from calldata, and divides it into `uint8 v, bytes32 r, bytes32 s`. * @param data The current transaction's calldata. * @return v The ECDSA v value * @return r The ECDSA r value * @return s The ECDSA s value */ function _splitSignature( bytes calldata data ) private pure returns (uint8 v, bytes32 r, bytes32 s) { v = uint8(bytes1(data[data.length - 1:])); r = bytes32(data[data.length - 65:]); s = bytes32(data[data.length - 33:]); } /** * @dev Calls the signer contract, and validates the contract signature. * @param signer The address of the signer contract. * @param hash Hash of the data signed * @param signature The contract signature. * @return result Indicates whether the signature is valid. */ function _isValidContractSignature( address signer, bytes32 hash, bytes calldata signature ) internal view returns (bool result) { uint256 size; // eslint-disable-line no-inline-assembly assembly { size := extcodesize(signer) } if (size == 0) { return false; } (, bytes memory returnData) = signer.staticcall( abi.encodeWithSelector( IERC1271.isValidSignature.selector, hash, signature ) ); return bytes4(returnData) == EIP1271_MAGIC_VALUE; } // keccak256( // "EIP712Domain(uint256 chainId,address verifyingContract)" // ); bytes32 private constant DOMAIN_SEPARATOR_TYPEHASH = 0x47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a79469218; // keccak256( // "ModuleTx(bytes data,bytes32 salt)" // ); bytes32 private constant MODULE_TX_TYPEHASH = 0x2939aeeda3ca260200c9f7b436b19e13207547ccc65cfedc857751c5ea6d91d4; // bytes4(keccak256( // "isValidSignature(bytes32,bytes)" // )); bytes4 private constant EIP1271_MAGIC_VALUE = 0x1626ba7e; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { /// @custom:storage-location erc7201:openzeppelin.storage.Ownable struct OwnableStorage { address _owner; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300; function _getOwnableStorage() private pure returns (OwnableStorage storage $) { assembly { $.slot := OwnableStorageLocation } } /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ function __Ownable_init(address initialOwner) internal onlyInitializing { __Ownable_init_unchained(initialOwner); } function __Ownable_init_unchained(address initialOwner) internal onlyInitializing { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { OwnableStorage storage $ = _getOwnableStorage(); return $._owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { OwnableStorage storage $ = _getOwnableStorage(); address oldOwner = $._owner; $._owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.20; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Storage of the initializable contract. * * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions * when using with upgradeable contracts. * * @custom:storage-location erc7201:openzeppelin.storage.Initializable */ struct InitializableStorage { /** * @dev Indicates that the contract has been initialized. */ uint64 _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool _initializing; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00; /** * @dev The contract is already initialized. */ error InvalidInitialization(); /** * @dev The contract is not initializing. */ error NotInitializing(); /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint64 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in * production. * * Emits an {Initialized} event. */ modifier initializer() { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); // Cache values to avoid duplicated sloads bool isTopLevelCall = !$._initializing; uint64 initialized = $._initialized; // Allowed calls: // - initialSetup: the contract is not in the initializing state and no previous version was // initialized // - construction: the contract is initialized at version 1 (no reininitialization) and the // current contract is just being deployed bool initialSetup = initialized == 0 && isTopLevelCall; bool construction = initialized == 1 && address(this).code.length == 0; if (!initialSetup && !construction) { revert InvalidInitialization(); } $._initialized = 1; if (isTopLevelCall) { $._initializing = true; } _; if (isTopLevelCall) { $._initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint64 version) { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing || $._initialized >= version) { revert InvalidInitialization(); } $._initialized = version; $._initializing = true; _; $._initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { _checkInitializing(); _; } /** * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}. */ function _checkInitializing() internal view virtual { if (!_isInitializing()) { revert NotInitializing(); } } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing) { revert InvalidInitialization(); } if ($._initialized != type(uint64).max) { $._initialized = type(uint64).max; emit Initialized(type(uint64).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint64) { return _getInitializableStorage()._initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _getInitializableStorage()._initializing; } /** * @dev Returns a pointer to the storage namespace. */ // solhint-disable-next-line var-name-mixedcase function _getInitializableStorage() private pure returns (InitializableStorage storage $) { assembly { $.slot := INITIALIZABLE_STORAGE } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Context.sol) pragma solidity ^0.8.20; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.8.17 <0.9.0; import "@gnosis.pm/safe-contracts/contracts/common/Enum.sol"; interface IMultiSend { function multiSend(bytes memory transactions) external payable; } struct UnwrappedTransaction { Enum.Operation operation; address to; uint256 value; // We wanna deal in calldata slices. We return location, let invoker slice uint256 dataLocation; uint256 dataSize; } interface ITransactionUnwrapper { function unwrap( address to, uint256 value, bytes calldata data, Enum.Operation operation ) external view returns (UnwrappedTransaction[] memory result); } interface ICustomCondition { function check( address to, uint256 value, bytes calldata data, Enum.Operation operation, uint256 location, uint256 size, bytes12 extra ) external view returns (bool success, bytes32 reason); }
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.8.17 <0.9.0; import "./Core.sol"; /** * @title AllowanceTracker - a component of the Zodiac Roles Mod that is * responsible for loading and calculating allowance balances. Persists * consumptions back to storage. * @author Cristóvão Honorato - <[email protected]> * @author Jan-Felix Schwarz - <[email protected]> */ abstract contract AllowanceTracker is Core { event ConsumeAllowance( bytes32 allowanceKey, uint128 consumed, uint128 newBalance ); function _accruedAllowance( Allowance memory allowance, uint64 blockTimestamp ) internal pure override returns (uint128 balance, uint64 timestamp) { if ( allowance.period == 0 || blockTimestamp < (allowance.timestamp + allowance.period) ) { return (allowance.balance, allowance.timestamp); } uint64 elapsedIntervals = (blockTimestamp - allowance.timestamp) / allowance.period; if (allowance.balance < allowance.maxRefill) { balance = allowance.balance + allowance.refill * elapsedIntervals; balance = balance < allowance.maxRefill ? balance : allowance.maxRefill; } else { balance = allowance.balance; } timestamp = allowance.timestamp + elapsedIntervals * allowance.period; } /** * @dev Flushes the consumption of allowances back into storage, before * execution. This flush is not final * @param consumptions The array of consumption structs containing * information about allowances and consumed amounts. */ function _flushPrepare(Consumption[] memory consumptions) internal { uint256 count = consumptions.length; for (uint256 i; i < count; ) { Consumption memory consumption = consumptions[i]; bytes32 key = consumption.allowanceKey; uint128 consumed = consumption.consumed; // Retrieve the allowance and calculate its current updated balance // and next refill timestamp. Allowance storage allowance = allowances[key]; (uint128 balance, uint64 timestamp) = _accruedAllowance( allowance, uint64(block.timestamp) ); assert(balance == consumption.balance); assert(consumed <= balance); // Flush allowance.balance = balance - consumed; allowance.timestamp = timestamp; unchecked { ++i; } } } /** * @dev Finalizes or reverts the flush of allowances, after transaction * execution * @param consumptions The array of consumption structs containing * information about allowances and consumed amounts. * @param success a boolean that indicates whether transaction execution * was successful */ function _flushCommit( Consumption[] memory consumptions, bool success ) internal { uint256 count = consumptions.length; for (uint256 i; i < count; ) { Consumption memory consumption = consumptions[i]; bytes32 key = consumption.allowanceKey; if (success) { emit ConsumeAllowance( key, consumption.consumed, consumption.balance - consumption.consumed ); } else { allowances[key].balance = consumption.balance; } unchecked { ++i; } } } }
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.8.17 <0.9.0; import "./Types.sol"; /** * @title Consumptions - a library that provides helper functions for dealing * with collection of Consumptions. * @author Cristóvão Honorato - <[email protected]> */ library Consumptions { function clone( Consumption[] memory consumptions ) internal pure returns (Consumption[] memory result) { uint256 length = consumptions.length; result = new Consumption[](length); for (uint256 i; i < length; ) { result[i].allowanceKey = consumptions[i].allowanceKey; result[i].balance = consumptions[i].balance; result[i].consumed = consumptions[i].consumed; unchecked { ++i; } } } function find( Consumption[] memory consumptions, bytes32 key ) internal pure returns (uint256, bool) { uint256 length = consumptions.length; for (uint256 i; i < length; ) { if (consumptions[i].allowanceKey == key) { return (i, true); } unchecked { ++i; } } return (0, false); } function merge( Consumption[] memory c1, Consumption[] memory c2 ) internal pure returns (Consumption[] memory result) { if (c1.length == 0) return c2; if (c2.length == 0) return c1; result = new Consumption[](c1.length + c2.length); uint256 length = c1.length; for (uint256 i; i < length; ) { result[i].allowanceKey = c1[i].allowanceKey; result[i].balance = c1[i].balance; result[i].consumed = c1[i].consumed; unchecked { ++i; } } for (uint256 i; i < c2.length; ) { (uint256 index, bool found) = find(c1, c2[i].allowanceKey); if (found) { result[index].consumed += c2[i].consumed; } else { result[length].allowanceKey = c2[i].allowanceKey; result[length].balance = c2[i].balance; result[length].consumed = c2[i].consumed; length++; } unchecked { ++i; } } if (length < result.length) { assembly { mstore(result, length) } } } }
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.8.17 <0.9.0; import "@gnosis.pm/zodiac/contracts/core/Modifier.sol"; import "./Types.sol"; /** * @title Core is the base contract for the Zodiac Roles Mod, which defines * the common abstract connection points between Builder, Loader, and Checker. * @author Cristóvão Honorato - <[email protected]> */ abstract contract Core is Modifier { mapping(bytes32 => Role) internal roles; mapping(bytes32 => Allowance) public allowances; function _store( Role storage role, bytes32 key, ConditionFlat[] memory conditions, ExecutionOptions options ) internal virtual; function _load( Role storage role, bytes32 key ) internal view virtual returns (Condition memory, Consumption[] memory); function _accruedAllowance( Allowance memory allowance, uint64 blockTimestamp ) internal pure virtual returns (uint128 balance, uint64 timestamp); function _key( address targetAddress, bytes4 selector ) internal pure returns (bytes32) { /* * Unoptimized version: * bytes32(abi.encodePacked(targetAddress, selector)) */ return bytes32(bytes20(targetAddress)) | (bytes32(selector) >> 160); } }
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.8.17 <0.9.0; import "./Topology.sol"; /** * @title Decoder - a library that discovers parameter locations in calldata * from a list of conditions. * @author Cristóvão Honorato - <[email protected]> */ library Decoder { error CalldataOutOfBounds(); /** * @dev Maps the location and size of parameters in the encoded transaction data. * @param data The encoded transaction data. * @param condition The condition of the parameters. * @return result The mapped location and size of parameters in the encoded transaction data. */ function inspect( bytes calldata data, Condition memory condition ) internal pure returns (ParameterPayload memory result) { /* * In the parameter encoding area, there is a region called the head * that is divided into 32-byte chunks. Each parameter has its own * corresponding chunk in the head region: * - Static parameters are encoded inline. * - Dynamic parameters have an offset to the tail, which is the start * of the actual encoding for the dynamic parameter. Note that the * offset does not include the 4-byte function signature." * */ Topology.TypeTree memory node = Topology.typeTree(condition); __block__(data, 4, node, node.children.length, false, result); result.location = 0; result.size = data.length; } /** * @dev Walks through a parameter encoding tree and maps their location and * size within calldata. * @param data The encoded transaction data. * @param location The current offset within the calldata buffer. * @param node The current node being traversed within the parameter tree. * @param result The location and size of the parameter within calldata. */ function _walk( bytes calldata data, uint256 location, Topology.TypeTree memory node, ParameterPayload memory result ) private pure { ParameterType paramType = node.paramType; if (paramType == ParameterType.Static) { result.size = 32; } else if (paramType == ParameterType.Dynamic) { result.size = 32 + _ceil32(uint256(word(data, location))); } else if (paramType == ParameterType.Tuple) { __block__( data, location, node, node.children.length, false, result ); } else if (paramType == ParameterType.Array) { __block__( data, location + 32, node, uint256(word(data, location)), true, result ); result.size += 32; } else if ( paramType == ParameterType.Calldata || paramType == ParameterType.AbiEncoded ) { __block__( data, location + 32 + (paramType == ParameterType.Calldata ? 4 : 0), node, node.children.length, false, result ); result.size = 32 + _ceil32(uint256(word(data, location))); } result.location = location; } /** * @dev Recursively walk through the TypeTree to decode a block of parameters. * @param data The encoded transaction data. * @param location The current location of the parameter block being processed. * @param node The current TypeTree node being processed. * @param length The number of parts in the block. * @param template whether first child is type descriptor for all parts. * @param result The decoded ParameterPayload. */ function __block__( bytes calldata data, uint256 location, Topology.TypeTree memory node, uint256 length, bool template, ParameterPayload memory result ) private pure { result.children = new ParameterPayload[](length); bool isInline; if (template) isInline = Topology.isInline(node.children[0]); uint256 offset; for (uint256 i; i < length; ) { if (!template) isInline = Topology.isInline(node.children[i]); _walk( data, _locationInBlock(data, location, offset, isInline), node.children[template ? 0 : i], result.children[i] ); uint256 childSize = result.children[i].size; result.size += isInline ? childSize : childSize + 32; offset += isInline ? childSize : 32; unchecked { ++i; } } } /** * @dev Returns the location of a block part, which may be located inline * within the block - at the HEAD - or at an offset relative to the start * of the block - at the TAIL. * * @param data The encoded transaction data. * @param location The location of the block within the calldata buffer. * @param offset The offset of the block part, relative to the start of the block. * @param isInline Whether the block part is located inline within the block. * * @return The location of the block part within the calldata buffer. */ function _locationInBlock( bytes calldata data, uint256 location, uint256 offset, bool isInline ) private pure returns (uint256) { uint256 headLocation = location + offset; if (isInline) { return headLocation; } else { return location + uint256(word(data, headLocation)); } } /** * @dev Plucks a slice of bytes from calldata. * @param data The calldata to pluck the slice from. * @param location The starting location of the slice. * @param size The size of the slice. * @return A slice of bytes from calldata. */ function pluck( bytes calldata data, uint256 location, uint256 size ) internal pure returns (bytes calldata) { return data[location:location + size]; } /** * @dev Loads a word from calldata. * @param data The calldata to load the word from. * @param location The starting location of the slice. * @return result 32 byte word from calldata. */ function word( bytes calldata data, uint256 location ) internal pure returns (bytes32 result) { if (location + 32 > data.length) { revert CalldataOutOfBounds(); } assembly { result := calldataload(add(data.offset, location)) } } function _ceil32(uint256 size) private pure returns (uint256) { // pad size. Source: http://www.cs.nott.ac.uk/~psarb2/G51MPC/slides/NumberLogic.pdf return ((size + 32 - 1) / 32) * 32; } }
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.8.17 <0.9.0; import "./Topology.sol"; /** * @title Integrity, A library that validates condition integrity, and * adherence to the expected input structure and rules. * @author Cristóvão Honorato - <[email protected]> */ library Integrity { error UnsuitableRootNode(); error NotBFS(); error UnsuitableParameterType(uint256 index); error UnsuitableCompValue(uint256 index); error UnsupportedOperator(uint256 index); error UnsuitableParent(uint256 index); error UnsuitableChildCount(uint256 index); error UnsuitableChildTypeTree(uint256 index); function enforce(ConditionFlat[] memory conditions) external pure { _root(conditions); for (uint256 i = 0; i < conditions.length; ++i) { _node(conditions[i], i); } _tree(conditions); } function _root(ConditionFlat[] memory conditions) private pure { uint256 count; for (uint256 i; i < conditions.length; ++i) { if (conditions[i].parent == i) ++count; } if (count != 1 || conditions[0].parent != 0) { revert UnsuitableRootNode(); } } function _node(ConditionFlat memory condition, uint256 index) private pure { Operator operator = condition.operator; ParameterType paramType = condition.paramType; bytes memory compValue = condition.compValue; if (operator == Operator.Pass) { if (condition.compValue.length != 0) { revert UnsuitableCompValue(index); } } else if (operator >= Operator.And && operator <= Operator.Nor) { if (paramType != ParameterType.None) { revert UnsuitableParameterType(index); } if (condition.compValue.length != 0) { revert UnsuitableCompValue(index); } } else if (operator == Operator.Matches) { if ( paramType != ParameterType.Tuple && paramType != ParameterType.Array && paramType != ParameterType.Calldata && paramType != ParameterType.AbiEncoded ) { revert UnsuitableParameterType(index); } if (compValue.length != 0) { revert UnsuitableCompValue(index); } } else if ( operator == Operator.ArraySome || operator == Operator.ArrayEvery || operator == Operator.ArraySubset ) { if (paramType != ParameterType.Array) { revert UnsuitableParameterType(index); } if (compValue.length != 0) { revert UnsuitableCompValue(index); } } else if (operator == Operator.EqualToAvatar) { if (paramType != ParameterType.Static) { revert UnsuitableParameterType(index); } if (compValue.length != 0) { revert UnsuitableCompValue(index); } } else if (operator == Operator.EqualTo) { if ( paramType != ParameterType.Static && paramType != ParameterType.Dynamic && paramType != ParameterType.Tuple && paramType != ParameterType.Array ) { revert UnsuitableParameterType(index); } if (compValue.length == 0 || compValue.length % 32 != 0) { revert UnsuitableCompValue(index); } } else if ( operator == Operator.GreaterThan || operator == Operator.LessThan || operator == Operator.SignedIntGreaterThan || operator == Operator.SignedIntLessThan ) { if (paramType != ParameterType.Static) { revert UnsuitableParameterType(index); } if (compValue.length != 32) { revert UnsuitableCompValue(index); } } else if (operator == Operator.Bitmask) { if ( paramType != ParameterType.Static && paramType != ParameterType.Dynamic ) { revert UnsuitableParameterType(index); } if (compValue.length != 32) { revert UnsuitableCompValue(index); } } else if (operator == Operator.Custom) { if (compValue.length != 32) { revert UnsuitableCompValue(index); } } else if (operator == Operator.WithinAllowance) { if (paramType != ParameterType.Static) { revert UnsuitableParameterType(index); } if (compValue.length != 32) { revert UnsuitableCompValue(index); } } else if ( operator == Operator.EtherWithinAllowance || operator == Operator.CallWithinAllowance ) { if (paramType != ParameterType.None) { revert UnsuitableParameterType(index); } if (compValue.length != 32) { revert UnsuitableCompValue(index); } } else { revert UnsupportedOperator(index); } } function _tree(ConditionFlat[] memory conditions) private pure { uint256 length = conditions.length; // check BFS for (uint256 i = 1; i < length; ++i) { if (conditions[i - 1].parent > conditions[i].parent) { revert NotBFS(); } } for (uint256 i = 0; i < length; ++i) { if ( (conditions[i].operator == Operator.EtherWithinAllowance || conditions[i].operator == Operator.CallWithinAllowance) && conditions[conditions[i].parent].paramType != ParameterType.Calldata ) { revert UnsuitableParent(i); } } Topology.Bounds[] memory childrenBounds = Topology.childrenBounds( conditions ); for (uint256 i = 0; i < conditions.length; i++) { ConditionFlat memory condition = conditions[i]; Topology.Bounds memory childBounds = childrenBounds[i]; if (condition.paramType == ParameterType.None) { if ( (condition.operator == Operator.EtherWithinAllowance || condition.operator == Operator.CallWithinAllowance) && childBounds.length != 0 ) { revert UnsuitableChildCount(i); } if ( (condition.operator >= Operator.And && condition.operator <= Operator.Nor) ) { if (childBounds.length == 0) { revert UnsuitableChildCount(i); } } } else if ( condition.paramType == ParameterType.Static || condition.paramType == ParameterType.Dynamic ) { if (childBounds.length != 0) { revert UnsuitableChildCount(i); } } else if ( condition.paramType == ParameterType.Tuple || condition.paramType == ParameterType.Calldata || condition.paramType == ParameterType.AbiEncoded ) { if (childBounds.length == 0) { revert UnsuitableChildCount(i); } } else { assert(condition.paramType == ParameterType.Array); if (childBounds.length == 0) { revert UnsuitableChildCount(i); } if ( (condition.operator == Operator.ArraySome || condition.operator == Operator.ArrayEvery) && childBounds.length != 1 ) { revert UnsuitableChildCount(i); } else if ( condition.operator == Operator.ArraySubset && childBounds.length > 256 ) { revert UnsuitableChildCount(i); } } } for (uint256 i = 0; i < conditions.length; i++) { ConditionFlat memory condition = conditions[i]; if ( ((condition.operator >= Operator.And && condition.operator <= Operator.Nor) || condition.paramType == ParameterType.Array) && childrenBounds[i].length > 1 ) { _compatibleSiblingTypes(conditions, i, childrenBounds); } } Topology.TypeTree memory typeTree = Topology.typeTree( conditions, 0, childrenBounds ); if (typeTree.paramType != ParameterType.Calldata) { revert UnsuitableRootNode(); } } function _compatibleSiblingTypes( ConditionFlat[] memory conditions, uint256 index, Topology.Bounds[] memory childrenBounds ) private pure { uint256 start = childrenBounds[index].start; uint256 end = childrenBounds[index].end; for (uint256 j = start + 1; j < end; ++j) { if ( !_isTypeMatch(conditions, start, j, childrenBounds) && !_isTypeEquivalent(conditions, start, j, childrenBounds) ) { revert UnsuitableChildTypeTree(index); } } } function _isTypeMatch( ConditionFlat[] memory conditions, uint256 i, uint256 j, Topology.Bounds[] memory childrenBounds ) private pure returns (bool) { return typeTreeId(Topology.typeTree(conditions, i, childrenBounds)) == typeTreeId(Topology.typeTree(conditions, j, childrenBounds)); } function _isTypeEquivalent( ConditionFlat[] memory conditions, uint256 i, uint256 j, Topology.Bounds[] memory childrenBounds ) private pure returns (bool) { ParameterType leftParamType = Topology .typeTree(conditions, i, childrenBounds) .paramType; return (leftParamType == ParameterType.Calldata || leftParamType == ParameterType.AbiEncoded) && Topology.typeTree(conditions, j, childrenBounds).paramType == ParameterType.Dynamic; } function typeTreeId( Topology.TypeTree memory node ) private pure returns (bytes32) { uint256 childCount = node.children.length; if (childCount > 0) { bytes32[] memory ids = new bytes32[](node.children.length); for (uint256 i = 0; i < childCount; ++i) { ids[i] = typeTreeId(node.children[i]); } return keccak256(abi.encodePacked(node.paramType, "-", ids)); } else { return bytes32(uint256(node.paramType)); } } }
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.8.17 <0.9.0; import "../Types.sol"; /** * @title BufferPacker a library that provides packing and unpacking functions * for conditions. It allows packing externally provided ConditionsFlat[] into * a storage-optimized buffer, and later unpack it into memory. * @author Cristóvão Honorato - <[email protected]> */ library BufferPacker { // HEADER (stored as a single word in storage) // 2 bytes -> count (Condition count) // 1 bytes -> options (ExecutionOptions) // 1 bytes -> isWildcarded // 8 bytes -> unused // 20 bytes -> pointer (address containining packed conditions) uint256 private constant OFFSET_COUNT = 240; uint256 private constant OFFSET_OPTIONS = 224; uint256 private constant OFFSET_IS_WILDCARDED = 216; uint256 private constant MASK_COUNT = 0xffff << OFFSET_COUNT; uint256 private constant MASK_OPTIONS = 0xff << OFFSET_OPTIONS; uint256 private constant MASK_IS_WILDCARDED = 0x1 << OFFSET_IS_WILDCARDED; // CONDITION (stored as runtimeBytecode at pointer address kept in header) // 8 bits -> parent // 3 bits -> type // 5 bits -> operator uint256 private constant BYTES_PER_CONDITION = 2; uint16 private constant OFFSET_PARENT = 8; uint16 private constant OFFSET_PARAM_TYPE = 5; uint16 private constant OFFSET_OPERATOR = 0; uint16 private constant MASK_PARENT = uint16(0xff << OFFSET_PARENT); uint16 private constant MASK_PARAM_TYPE = uint16(0x07 << OFFSET_PARAM_TYPE); uint16 private constant MASK_OPERATOR = uint16(0x1f << OFFSET_OPERATOR); function packedSize( ConditionFlat[] memory conditions ) internal pure returns (uint256 result) { uint256 count = conditions.length; result = count * BYTES_PER_CONDITION; for (uint256 i; i < count; ++i) { if (conditions[i].operator >= Operator.EqualTo) { result += 32; } } } function packHeader( uint256 count, ExecutionOptions options, address pointer ) internal pure returns (bytes32) { return bytes32(count << OFFSET_COUNT) | (bytes32(uint256(options)) << OFFSET_OPTIONS) | bytes32(uint256(uint160(pointer))); } function packHeaderAsWildcarded( ExecutionOptions options ) internal pure returns (bytes32) { return bytes32(uint256(options) << OFFSET_OPTIONS) | bytes32(MASK_IS_WILDCARDED); } function unpackHeader( bytes32 header ) internal pure returns (uint256 count, address pointer) { count = (uint256(header) & MASK_COUNT) >> OFFSET_COUNT; pointer = address(bytes20(uint160(uint256(header)))); } function unpackOptions( bytes32 header ) internal pure returns (bool isWildcarded, ExecutionOptions options) { isWildcarded = uint256(header) & MASK_IS_WILDCARDED != 0; options = ExecutionOptions( (uint256(header) & MASK_OPTIONS) >> OFFSET_OPTIONS ); } function packCondition( bytes memory buffer, uint256 index, ConditionFlat memory condition ) internal pure { uint256 offset = index * BYTES_PER_CONDITION; buffer[offset] = bytes1(condition.parent); buffer[offset + 1] = bytes1( (uint8(condition.paramType) << uint8(OFFSET_PARAM_TYPE)) | uint8(condition.operator) ); } function packCompValue( bytes memory buffer, uint256 offset, ConditionFlat memory condition ) internal pure { bytes32 word = condition.operator == Operator.EqualTo ? keccak256(condition.compValue) : bytes32(condition.compValue); assembly { mstore(add(buffer, offset), word) } } function unpackBody( bytes memory buffer, uint256 count ) internal pure returns (ConditionFlat[] memory result, bytes32[] memory compValues) { result = new ConditionFlat[](count); compValues = new bytes32[](count); bytes32 word; uint256 offset = 32; uint256 compValueOffset = 32 + count * BYTES_PER_CONDITION; for (uint256 i; i < count; ) { assembly { word := mload(add(buffer, offset)) } offset += BYTES_PER_CONDITION; uint16 bits = uint16(bytes2(word)); ConditionFlat memory condition = result[i]; condition.parent = uint8((bits & MASK_PARENT) >> OFFSET_PARENT); condition.paramType = ParameterType( (bits & MASK_PARAM_TYPE) >> OFFSET_PARAM_TYPE ); condition.operator = Operator(bits & MASK_OPERATOR); if (condition.operator >= Operator.EqualTo) { assembly { word := mload(add(buffer, compValueOffset)) } compValueOffset += 32; compValues[i] = word; } unchecked { ++i; } } } }
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.8.17 <0.9.0; import "@gnosis.pm/zodiac/contracts/core/Modifier.sol"; import "./BufferPacker.sol"; /** * @title Packer - a library that coordinates the process of packing * conditionsFlat into a storage optimized buffer. * @author Cristóvão Honorato - <[email protected]> */ library Packer { function pack( ConditionFlat[] memory conditionsFlat ) external pure returns (bytes memory buffer) { _removeExtraneousOffsets(conditionsFlat); buffer = new bytes(BufferPacker.packedSize(conditionsFlat)); uint256 count = conditionsFlat.length; uint256 offset = 32 + count * 2; for (uint256 i; i < count; ++i) { BufferPacker.packCondition(buffer, i, conditionsFlat[i]); if (conditionsFlat[i].operator >= Operator.EqualTo) { BufferPacker.packCompValue(buffer, offset, conditionsFlat[i]); offset += 32; } } } /** * @dev This function removes unnecessary offsets from compValue fields of * the `conditions` array. Its purpose is to ensure a consistent API where * every `compValue` provided for use in `Operations.EqualsTo` is obtained * by calling `abi.encode` directly. * * By removing the leading extraneous offsets this function makes * abi.encode(...) match the output produced by Decoder inspection. * Without it, the encoded fields would need to be patched externally * depending on whether the payload is fully encoded inline or not. * * @param conditionsFlat Array of ConditionFlat structs to remove extraneous * offsets from */ function _removeExtraneousOffsets( ConditionFlat[] memory conditionsFlat ) private pure { uint256 count = conditionsFlat.length; for (uint256 i; i < count; ++i) { if ( conditionsFlat[i].operator == Operator.EqualTo && !_isInline(conditionsFlat, i) ) { bytes memory compValue = conditionsFlat[i].compValue; uint256 length = compValue.length; assembly { compValue := add(compValue, 32) mstore(compValue, sub(length, 32)) } conditionsFlat[i].compValue = compValue; } } } function _isInline( ConditionFlat[] memory conditions, uint256 index ) private pure returns (bool) { ParameterType paramType = conditions[index].paramType; if (paramType == ParameterType.Static) { return true; } else if ( paramType == ParameterType.Dynamic || paramType == ParameterType.Array || paramType == ParameterType.Calldata || paramType == ParameterType.AbiEncoded ) { return false; } else { uint256 length = conditions.length; for (uint256 j = index + 1; j < length; ++j) { uint8 parent = conditions[j].parent; if (parent < index) { continue; } if (parent > index) { break; } if (!_isInline(conditions, j)) { return false; } } return true; } } }
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.8.17 <0.9.0; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "./adapters/Types.sol"; /** * @title Periphery - a coordinating component that facilitates plug-and-play * functionality for the Zodiac Roles Mod through the use of adapters. * @author Cristóvão Honorato - <[email protected]> */ abstract contract Periphery is OwnableUpgradeable { event SetUnwrapAdapter( address to, bytes4 selector, ITransactionUnwrapper adapter ); mapping(bytes32 => ITransactionUnwrapper) public unwrappers; function setTransactionUnwrapper( address to, bytes4 selector, ITransactionUnwrapper adapter ) external onlyOwner { unwrappers[bytes32(bytes20(to)) | (bytes32(selector) >> 160)] = adapter; emit SetUnwrapAdapter(to, selector, adapter); } function getTransactionUnwrapper( address to, bytes4 selector ) internal view returns (ITransactionUnwrapper) { return unwrappers[bytes32(bytes20(to)) | (bytes32(selector) >> 160)]; } }
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.8.17 <0.9.0; import "./Core.sol"; import "./Integrity.sol"; import "./packers/BufferPacker.sol"; /** * @title PermissionBuilder - a component of the Zodiac Roles Mod that is * responsible for constructing, managing, granting, and revoking all types * of permission data. * @author Cristóvão Honorato - <[email protected]> * @author Jan-Felix Schwarz - <[email protected]> */ abstract contract PermissionBuilder is Core { event AllowTarget( bytes32 roleKey, address targetAddress, ExecutionOptions options ); event RevokeTarget(bytes32 roleKey, address targetAddress); event ScopeTarget(bytes32 roleKey, address targetAddress); event AllowFunction( bytes32 roleKey, address targetAddress, bytes4 selector, ExecutionOptions options ); event RevokeFunction( bytes32 roleKey, address targetAddress, bytes4 selector ); event ScopeFunction( bytes32 roleKey, address targetAddress, bytes4 selector, ConditionFlat[] conditions, ExecutionOptions options ); event SetAllowance( bytes32 allowanceKey, uint128 balance, uint128 maxRefill, uint128 refill, uint64 period, uint64 timestamp ); /// @dev Allows transactions to a target address. /// @param roleKey identifier of the role to be modified. /// @param targetAddress Destination address of transaction. /// @param options designates if a transaction can send ether and/or delegatecall to target. function allowTarget( bytes32 roleKey, address targetAddress, ExecutionOptions options ) external onlyOwner { roles[roleKey].targets[targetAddress] = TargetAddress({ clearance: Clearance.Target, options: options }); emit AllowTarget(roleKey, targetAddress, options); } /// @dev Removes transactions to a target address. /// @param roleKey identifier of the role to be modified. /// @param targetAddress Destination address of transaction. function revokeTarget( bytes32 roleKey, address targetAddress ) external onlyOwner { roles[roleKey].targets[targetAddress] = TargetAddress({ clearance: Clearance.None, options: ExecutionOptions.None }); emit RevokeTarget(roleKey, targetAddress); } /// @dev Designates only specific functions can be called. /// @param roleKey identifier of the role to be modified. /// @param targetAddress Destination address of transaction. function scopeTarget( bytes32 roleKey, address targetAddress ) external onlyOwner { roles[roleKey].targets[targetAddress] = TargetAddress({ clearance: Clearance.Function, options: ExecutionOptions.None }); emit ScopeTarget(roleKey, targetAddress); } /// @dev Specifies the functions that can be called. /// @param roleKey identifier of the role to be modified. /// @param targetAddress Destination address of transaction. /// @param selector 4 byte function selector. /// @param options designates if a transaction can send ether and/or delegatecall to target. function allowFunction( bytes32 roleKey, address targetAddress, bytes4 selector, ExecutionOptions options ) external onlyOwner { roles[roleKey].scopeConfig[_key(targetAddress, selector)] = BufferPacker .packHeaderAsWildcarded(options); emit AllowFunction(roleKey, targetAddress, selector, options); } /// @dev Removes the functions that can be called. /// @param roleKey identifier of the role to be modified. /// @param targetAddress Destination address of transaction. /// @param selector 4 byte function selector. function revokeFunction( bytes32 roleKey, address targetAddress, bytes4 selector ) external onlyOwner { delete roles[roleKey].scopeConfig[_key(targetAddress, selector)]; emit RevokeFunction(roleKey, targetAddress, selector); } /// @dev Sets conditions to enforce on calls to the specified target. /// @param roleKey identifier of the role to be modified. /// @param targetAddress Destination address of transaction. /// @param selector 4 byte function selector. /// @param conditions The conditions to enforce. /// @param options designates if a transaction can send ether and/or delegatecall to target. function scopeFunction( bytes32 roleKey, address targetAddress, bytes4 selector, ConditionFlat[] memory conditions, ExecutionOptions options ) external onlyOwner { Integrity.enforce(conditions); _store( roles[roleKey], _key(targetAddress, selector), conditions, options ); emit ScopeFunction( roleKey, targetAddress, selector, conditions, options ); } function setAllowance( bytes32 key, uint128 balance, uint128 maxRefill, uint128 refill, uint64 period, uint64 timestamp ) external onlyOwner { maxRefill = maxRefill != 0 ? maxRefill : type(uint128).max; timestamp = timestamp != 0 ? timestamp : uint64(block.timestamp); allowances[key] = Allowance({ refill: refill, maxRefill: maxRefill, period: period, timestamp: timestamp, balance: balance }); emit SetAllowance(key, balance, maxRefill, refill, period, timestamp); } }
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.8.17 <0.9.0; import "@gnosis.pm/safe-contracts/contracts/common/Enum.sol"; import "./Consumptions.sol"; import "./Core.sol"; import "./Decoder.sol"; import "./Periphery.sol"; import "./packers/BufferPacker.sol"; /** * @title PermissionChecker - a component of Zodiac Roles Mod responsible * for enforcing and authorizing actions performed on behalf of a role. * * @author Cristóvão Honorato - <[email protected]> * @author Jan-Felix Schwarz - <[email protected]> */ abstract contract PermissionChecker is Core, Periphery { function _authorize( bytes32 roleKey, address to, uint256 value, bytes calldata data, Enum.Operation operation ) internal moduleOnly returns (Consumption[] memory) { // We never authorize the zero role, as it could clash with the // unassigned default role if (roleKey == 0) { revert NoMembership(); } Role storage role = roles[roleKey]; if (!role.members[sentOrSignedByModule()]) { revert NoMembership(); } ITransactionUnwrapper adapter = getTransactionUnwrapper( to, bytes4(data) ); Status status; Result memory result; if (address(adapter) == address(0)) { (status, result) = _transaction( role, to, value, data, operation, result.consumptions ); } else { (status, result) = _multiEntrypoint( ITransactionUnwrapper(adapter), role, to, value, data, operation ); } if (status != Status.Ok) { revert ConditionViolation(status, result.info); } return result.consumptions; } function _multiEntrypoint( ITransactionUnwrapper adapter, Role storage role, address to, uint256 value, bytes calldata data, Enum.Operation operation ) private view returns (Status status, Result memory result) { try adapter.unwrap(to, value, data, operation) returns ( UnwrappedTransaction[] memory transactions ) { for (uint256 i; i < transactions.length; ) { UnwrappedTransaction memory transaction = transactions[i]; uint256 left = transaction.dataLocation; uint256 right = left + transaction.dataSize; (status, result) = _transaction( role, transaction.to, transaction.value, data[left:right], transaction.operation, result.consumptions ); if (status != Status.Ok) { return (status, result); } unchecked { ++i; } } } catch { revert MalformedMultiEntrypoint(); } } /// @dev Inspects an individual transaction and performs checks based on permission scoping. /// Wildcarded indicates whether params need to be inspected or not. When true, only ExecutionOptions are checked. /// @param role Role to check for. /// @param to Destination address of transaction. /// @param value Ether value of module transaction. /// @param data Data payload of module transaction. /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call. function _transaction( Role storage role, address to, uint256 value, bytes calldata data, Enum.Operation operation, Consumption[] memory consumptions ) private view returns (Status, Result memory) { if (data.length != 0 && data.length < 4) { revert FunctionSignatureTooShort(); } if (role.targets[to].clearance == Clearance.Function) { bytes32 key = _key(to, bytes4(data)); { bytes32 header = role.scopeConfig[key]; if (header == 0) { return ( Status.FunctionNotAllowed, Result({ consumptions: consumptions, info: bytes32(bytes4(data)) }) ); } (bool isWildcarded, ExecutionOptions options) = BufferPacker .unpackOptions(header); Status status = _executionOptions(value, operation, options); if (status != Status.Ok) { return ( status, Result({consumptions: consumptions, info: 0}) ); } if (isWildcarded) { return ( Status.Ok, Result({consumptions: consumptions, info: 0}) ); } } return _scopedFunction( role, key, data, Context({ to: to, value: value, operation: operation, consumptions: consumptions }) ); } else if (role.targets[to].clearance == Clearance.Target) { return ( _executionOptions(value, operation, role.targets[to].options), Result({consumptions: consumptions, info: 0}) ); } else { return ( Status.TargetAddressNotAllowed, Result({consumptions: consumptions, info: 0}) ); } } /// @dev Examines the ether value and operation for a given role target. /// @param value Ether value of module transaction. /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call. /// @param options Determines if a transaction can send ether and/or delegatecall to target. function _executionOptions( uint256 value, Enum.Operation operation, ExecutionOptions options ) private pure returns (Status) { // isSend && !canSend if ( value > 0 && options != ExecutionOptions.Send && options != ExecutionOptions.Both ) { return Status.SendNotAllowed; } // isDelegateCall && !canDelegateCall if ( operation == Enum.Operation.DelegateCall && options != ExecutionOptions.DelegateCall && options != ExecutionOptions.Both ) { return Status.DelegateCallNotAllowed; } return Status.Ok; } function _scopedFunction( Role storage role, bytes32 key, bytes calldata data, Context memory context ) private view returns (Status, Result memory) { (Condition memory condition, Consumption[] memory consumptions) = _load( role, key ); ParameterPayload memory payload = Decoder.inspect(data, condition); context.consumptions = context.consumptions.length > 0 ? Consumptions.merge(context.consumptions, consumptions) : consumptions; return _walk(data, condition, payload, context); } function _walk( bytes calldata data, Condition memory condition, ParameterPayload memory payload, Context memory context ) private view returns (Status, Result memory) { Operator operator = condition.operator; if (operator < Operator.EqualTo) { if (operator == Operator.Pass) { return ( Status.Ok, Result({consumptions: context.consumptions, info: 0}) ); } else if (operator == Operator.Matches) { return _matches(data, condition, payload, context); } else if (operator == Operator.And) { return _and(data, condition, payload, context); } else if (operator == Operator.Or) { return _or(data, condition, payload, context); } else if (operator == Operator.Nor) { return _nor(data, condition, payload, context); } else if (operator == Operator.ArraySome) { return _arraySome(data, condition, payload, context); } else if (operator == Operator.ArrayEvery) { return _arrayEvery(data, condition, payload, context); } else { assert(operator == Operator.ArraySubset); return _arraySubset(data, condition, payload, context); } } else { if (operator <= Operator.LessThan) { return ( _compare(data, condition, payload), Result({consumptions: context.consumptions, info: 0}) ); } else if (operator <= Operator.SignedIntLessThan) { return ( _compareSignedInt(data, condition, payload), Result({consumptions: context.consumptions, info: 0}) ); } else if (operator == Operator.Bitmask) { return ( _bitmask(data, condition, payload), Result({consumptions: context.consumptions, info: 0}) ); } else if (operator == Operator.Custom) { return _custom(data, condition, payload, context); } else if (operator == Operator.WithinAllowance) { return _withinAllowance(data, condition, payload, context); } else if (operator == Operator.EtherWithinAllowance) { return _etherWithinAllowance(condition, context); } else { assert(operator == Operator.CallWithinAllowance); return _callWithinAllowance(condition, context); } } } function _matches( bytes calldata data, Condition memory condition, ParameterPayload memory payload, Context memory context ) private view returns (Status status, Result memory result) { result.consumptions = context.consumptions; if (condition.children.length != payload.children.length) { return (Status.ParameterNotAMatch, result); } for (uint256 i; i < condition.children.length; ) { (status, result) = _walk( data, condition.children[i], payload.children[i], Context({ to: context.to, value: context.value, operation: context.operation, consumptions: result.consumptions }) ); if (status != Status.Ok) { return ( status, Result({ consumptions: context.consumptions, info: result.info }) ); } unchecked { ++i; } } return (Status.Ok, result); } function _and( bytes calldata data, Condition memory condition, ParameterPayload memory payload, Context memory context ) private view returns (Status status, Result memory result) { result.consumptions = context.consumptions; for (uint256 i; i < condition.children.length; ) { (status, result) = _walk( data, condition.children[i], payload, Context({ to: context.to, value: context.value, operation: context.operation, consumptions: result.consumptions }) ); if (status != Status.Ok) { return ( status, Result({ consumptions: context.consumptions, info: result.info }) ); } unchecked { ++i; } } return (Status.Ok, result); } function _or( bytes calldata data, Condition memory condition, ParameterPayload memory payload, Context memory context ) private view returns (Status status, Result memory result) { result.consumptions = context.consumptions; for (uint256 i; i < condition.children.length; ) { (status, result) = _walk( data, condition.children[i], payload, Context({ to: context.to, value: context.value, operation: context.operation, consumptions: result.consumptions }) ); if (status == Status.Ok) { return (status, result); } unchecked { ++i; } } return ( Status.OrViolation, Result({consumptions: context.consumptions, info: 0}) ); } function _nor( bytes calldata data, Condition memory condition, ParameterPayload memory payload, Context memory context ) private view returns (Status status, Result memory) { for (uint256 i; i < condition.children.length; ) { (status, ) = _walk(data, condition.children[i], payload, context); if (status == Status.Ok) { return ( Status.NorViolation, Result({consumptions: context.consumptions, info: 0}) ); } unchecked { ++i; } } return ( Status.Ok, Result({consumptions: context.consumptions, info: 0}) ); } function _arraySome( bytes calldata data, Condition memory condition, ParameterPayload memory payload, Context memory context ) private view returns (Status status, Result memory result) { result.consumptions = context.consumptions; uint256 length = condition.children.length; for (uint256 i; i < length; ) { (status, result) = _walk( data, condition.children[0], payload.children[i], Context({ to: context.to, value: context.value, operation: context.operation, consumptions: result.consumptions }) ); if (status == Status.Ok) { return (status, result); } unchecked { ++i; } } return ( Status.NoArrayElementPasses, Result({consumptions: context.consumptions, info: 0}) ); } function _arrayEvery( bytes calldata data, Condition memory condition, ParameterPayload memory payload, Context memory context ) private view returns (Status status, Result memory result) { result.consumptions = context.consumptions; for (uint256 i; i < payload.children.length; ) { (status, result) = _walk( data, condition.children[0], payload.children[i], Context({ to: context.to, value: context.value, operation: context.operation, consumptions: result.consumptions }) ); if (status != Status.Ok) { return ( Status.NotEveryArrayElementPasses, Result({consumptions: context.consumptions, info: 0}) ); } unchecked { ++i; } } return (Status.Ok, result); } function _arraySubset( bytes calldata data, Condition memory condition, ParameterPayload memory payload, Context memory context ) private view returns (Status, Result memory result) { result.consumptions = context.consumptions; if ( payload.children.length == 0 || payload.children.length > condition.children.length ) { return (Status.ParameterNotSubsetOfAllowed, result); } uint256 taken; for (uint256 i; i < payload.children.length; ++i) { bool found = false; for (uint256 j; j < condition.children.length; ++j) { if (taken & (1 << j) != 0) continue; (Status status, Result memory _result) = _walk( data, condition.children[j], payload.children[i], Context({ to: context.to, value: context.value, operation: context.operation, consumptions: result.consumptions }) ); if (status == Status.Ok) { found = true; taken |= 1 << j; result = _result; break; } } if (!found) { return ( Status.ParameterNotSubsetOfAllowed, Result({consumptions: context.consumptions, info: 0}) ); } } return (Status.Ok, result); } function _compare( bytes calldata data, Condition memory condition, ParameterPayload memory payload ) private pure returns (Status) { Operator operator = condition.operator; bytes32 compValue = condition.compValue; bytes32 value = operator == Operator.EqualTo ? keccak256(Decoder.pluck(data, payload.location, payload.size)) : Decoder.word(data, payload.location); if (operator == Operator.EqualTo && value != compValue) { return Status.ParameterNotAllowed; } else if (operator == Operator.GreaterThan && value <= compValue) { return Status.ParameterLessThanAllowed; } else if (operator == Operator.LessThan && value >= compValue) { return Status.ParameterGreaterThanAllowed; } else { return Status.Ok; } } function _compareSignedInt( bytes calldata data, Condition memory condition, ParameterPayload memory payload ) private pure returns (Status) { Operator operator = condition.operator; int256 compValue = int256(uint256(condition.compValue)); int256 value = int256(uint256(Decoder.word(data, payload.location))); if (operator == Operator.SignedIntGreaterThan && value <= compValue) { return Status.ParameterLessThanAllowed; } else if ( operator == Operator.SignedIntLessThan && value >= compValue ) { return Status.ParameterGreaterThanAllowed; } else { return Status.Ok; } } /** * Applies a shift and bitmask on the payload bytes and compares the * result to the expected value. The shift offset, bitmask, and expected * value are specified in the compValue parameter, which is tightly * packed as follows: * <2 bytes shift offset><15 bytes bitmask><15 bytes expected value> */ function _bitmask( bytes calldata data, Condition memory condition, ParameterPayload memory payload ) private pure returns (Status) { bytes32 compValue = condition.compValue; bool isInline = condition.paramType == ParameterType.Static; bytes calldata value = Decoder.pluck( data, payload.location + (isInline ? 0 : 32), payload.size - (isInline ? 0 : 32) ); uint256 shift = uint16(bytes2(compValue)); if (shift >= value.length) { return Status.BitmaskOverflow; } bytes32 rinse = bytes15(0xffffffffffffffffffffffffffffff); bytes32 mask = (compValue << 16) & rinse; // while its necessary to apply the rinse to the mask its not strictly // necessary to do so for the expected value, since we get remaining // 15 bytes anyway (shifting the word by 17 bytes) bytes32 expected = (compValue << (16 + 15 * 8)) & rinse; bytes32 slice = bytes32(value[shift:]); return (slice & mask) == expected ? Status.Ok : Status.BitmaskNotAllowed; } function _custom( bytes calldata data, Condition memory condition, ParameterPayload memory payload, Context memory context ) private view returns (Status, Result memory) { // 20 bytes on the left ICustomCondition adapter = ICustomCondition( address(bytes20(condition.compValue)) ); // 12 bytes on the right bytes12 extra = bytes12(uint96(uint256(condition.compValue))); (bool success, bytes32 info) = adapter.check( context.to, context.value, data, context.operation, payload.location, payload.size, extra ); return ( success ? Status.Ok : Status.CustomConditionViolation, Result({consumptions: context.consumptions, info: info}) ); } function _withinAllowance( bytes calldata data, Condition memory condition, ParameterPayload memory payload, Context memory context ) private pure returns (Status, Result memory) { uint256 value = uint256(Decoder.word(data, payload.location)); return __consume(value, condition, context.consumptions); } function _etherWithinAllowance( Condition memory condition, Context memory context ) private pure returns (Status status, Result memory result) { (status, result) = __consume( context.value, condition, context.consumptions ); return ( status == Status.Ok ? Status.Ok : Status.EtherAllowanceExceeded, result ); } function _callWithinAllowance( Condition memory condition, Context memory context ) private pure returns (Status status, Result memory result) { (status, result) = __consume(1, condition, context.consumptions); return ( status == Status.Ok ? Status.Ok : Status.CallAllowanceExceeded, result ); } function __consume( uint256 value, Condition memory condition, Consumption[] memory consumptions ) private pure returns (Status, Result memory) { (uint256 index, bool found) = Consumptions.find( consumptions, condition.compValue ); assert(found); if ( value + consumptions[index].consumed > consumptions[index].balance ) { return ( Status.AllowanceExceeded, Result({ consumptions: consumptions, info: consumptions[index].allowanceKey }) ); } else { consumptions = Consumptions.clone(consumptions); consumptions[index].consumed += uint128(value); return (Status.Ok, Result({consumptions: consumptions, info: 0})); } } struct Context { address to; uint256 value; Consumption[] consumptions; Enum.Operation operation; } struct Result { Consumption[] consumptions; bytes32 info; } enum Status { Ok, /// Role not allowed to delegate call to target address DelegateCallNotAllowed, /// Role not allowed to call target address TargetAddressNotAllowed, /// Role not allowed to call this function on target address FunctionNotAllowed, /// Role not allowed to send to target address SendNotAllowed, /// Or conition not met OrViolation, /// Nor conition not met NorViolation, /// Parameter value is not equal to allowed ParameterNotAllowed, /// Parameter value less than allowed ParameterLessThanAllowed, /// Parameter value greater than maximum allowed by role ParameterGreaterThanAllowed, /// Parameter value does not match ParameterNotAMatch, /// Array elements do not meet allowed criteria for every element NotEveryArrayElementPasses, /// Array elements do not meet allowed criteria for at least one element NoArrayElementPasses, /// Parameter value not a subset of allowed ParameterNotSubsetOfAllowed, /// Bitmask exceeded value length BitmaskOverflow, /// Bitmask not an allowed value BitmaskNotAllowed, CustomConditionViolation, AllowanceExceeded, CallAllowanceExceeded, EtherAllowanceExceeded } /// Sender is not a member of the role error NoMembership(); /// Function signature too short error FunctionSignatureTooShort(); /// Calldata unwrapping failed error MalformedMultiEntrypoint(); error ConditionViolation(Status status, bytes32 info); }
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.8.17 <0.9.0; import "@gnosis.pm/zodiac/contracts/core/Modifier.sol"; import "./Consumptions.sol"; import "./Core.sol"; import "./Topology.sol"; import "./WriteOnce.sol"; import "./packers/Packer.sol"; /** * @title PermissionLoader - a component of the Zodiac Roles Mod that handles * the writing and reading of permission data to and from storage. * @author Cristóvão Honorato - <[email protected]> * @author Jan-Felix Schwarz - <[email protected]> */ abstract contract PermissionLoader is Core { function _store( Role storage role, bytes32 key, ConditionFlat[] memory conditions, ExecutionOptions options ) internal override { bytes memory buffer = Packer.pack(conditions); address pointer = WriteOnce.store(buffer); role.scopeConfig[key] = BufferPacker.packHeader( conditions.length, options, pointer ); } function _load( Role storage role, bytes32 key ) internal view override returns (Condition memory condition, Consumption[] memory consumptions) { (uint256 count, address pointer) = BufferPacker.unpackHeader( role.scopeConfig[key] ); bytes memory buffer = WriteOnce.load(pointer); ( ConditionFlat[] memory conditionsFlat, bytes32[] memory compValues ) = BufferPacker.unpackBody(buffer, count); uint256 allowanceCount; for (uint256 i; i < conditionsFlat.length; ) { Operator operator = conditionsFlat[i].operator; if (operator >= Operator.WithinAllowance) { ++allowanceCount; } else if (operator == Operator.EqualToAvatar) { // patch Operator.EqualToAvatar which in reality works as // a placeholder conditionsFlat[i].operator = Operator.EqualTo; compValues[i] = keccak256(abi.encode(avatar)); } unchecked { ++i; } } _conditionTree( conditionsFlat, compValues, Topology.childrenBounds(conditionsFlat), 0, condition ); return ( condition, allowanceCount > 0 ? _consumptions(conditionsFlat, compValues, allowanceCount) : consumptions ); } function _conditionTree( ConditionFlat[] memory conditionsFlat, bytes32[] memory compValues, Topology.Bounds[] memory childrenBounds, uint256 index, Condition memory treeNode ) private pure { // This function populates a buffer received as an argument instead of // instantiating a result object. This is an important gas optimization ConditionFlat memory conditionFlat = conditionsFlat[index]; treeNode.paramType = conditionFlat.paramType; treeNode.operator = conditionFlat.operator; treeNode.compValue = compValues[index]; if (childrenBounds[index].length == 0) { return; } uint256 start = childrenBounds[index].start; uint256 length = childrenBounds[index].length; treeNode.children = new Condition[](length); for (uint j; j < length; ) { _conditionTree( conditionsFlat, compValues, childrenBounds, start + j, treeNode.children[j] ); unchecked { ++j; } } } function _consumptions( ConditionFlat[] memory conditions, bytes32[] memory compValues, uint256 maxAllowanceCount ) private view returns (Consumption[] memory result) { uint256 count = conditions.length; result = new Consumption[](maxAllowanceCount); uint256 insert; for (uint256 i; i < count; ++i) { if (conditions[i].operator < Operator.WithinAllowance) { continue; } bytes32 key = compValues[i]; (, bool contains) = Consumptions.find(result, key); if (contains) { continue; } result[insert].allowanceKey = key; (result[insert].balance, ) = _accruedAllowance( allowances[key], uint64(block.timestamp) ); insert++; } if (insert < maxAllowanceCount) { assembly { mstore(result, insert) } } } }
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.8.17 <0.9.0; import "./Types.sol"; /** * @title Topology - a library that provides helper functions for dealing with * the flat representation of conditions. * @author Cristóvão Honorato - <[email protected]> */ library Topology { struct TypeTree { ParameterType paramType; TypeTree[] children; } struct Bounds { uint256 start; uint256 end; uint256 length; } function childrenBounds( ConditionFlat[] memory conditions ) internal pure returns (Bounds[] memory result) { uint256 count = conditions.length; assert(count > 0); // parents are breadth-first result = new Bounds[](count); result[0].start = type(uint256).max; // first item is the root for (uint256 i = 1; i < count; ) { result[i].start = type(uint256).max; Bounds memory parentBounds = result[conditions[i].parent]; if (parentBounds.start == type(uint256).max) { parentBounds.start = i; } parentBounds.end = i + 1; parentBounds.length = parentBounds.end - parentBounds.start; unchecked { ++i; } } } function isInline(TypeTree memory node) internal pure returns (bool) { ParameterType paramType = node.paramType; if (paramType == ParameterType.Static) { return true; } else if ( paramType == ParameterType.Dynamic || paramType == ParameterType.Array || paramType == ParameterType.Calldata || paramType == ParameterType.AbiEncoded ) { return false; } else { uint256 length = node.children.length; for (uint256 i; i < length; ) { if (!isInline(node.children[i])) { return false; } unchecked { ++i; } } return true; } } function typeTree( Condition memory condition ) internal pure returns (TypeTree memory result) { if ( condition.operator >= Operator.And && condition.operator <= Operator.Nor ) { assert(condition.children.length > 0); return typeTree(condition.children[0]); } result.paramType = condition.paramType; if (condition.children.length > 0) { uint256 length = condition.paramType == ParameterType.Array ? 1 : condition.children.length; result.children = new TypeTree[](length); for (uint256 i; i < length; ) { result.children[i] = typeTree(condition.children[i]); unchecked { ++i; } } } } function typeTree( ConditionFlat[] memory conditions, uint256 index, Bounds[] memory bounds ) internal pure returns (TypeTree memory result) { ConditionFlat memory condition = conditions[index]; if ( condition.operator >= Operator.And && condition.operator <= Operator.Nor ) { assert(bounds[index].length > 0); return typeTree(conditions, bounds[index].start, bounds); } result.paramType = condition.paramType; if (bounds[index].length > 0) { uint256 start = bounds[index].start; uint256 end = condition.paramType == ParameterType.Array ? bounds[index].start + 1 : bounds[index].end; result.children = new TypeTree[](end - start); for (uint256 i = start; i < end; ) { result.children[i - start] = typeTree(conditions, i, bounds); unchecked { ++i; } } } } }
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.8.17 <0.9.0; /** * @title Types - a file that contains all of the type definitions used throughout * the Zodiac Roles Mod. * @author Cristóvão Honorato - <[email protected]> * @author Jan-Felix Schwarz - <[email protected]> */ enum ParameterType { None, Static, Dynamic, Tuple, Array, Calldata, AbiEncoded } enum Operator { // 00: EMPTY EXPRESSION (default, always passes) // paramType: Static / Dynamic / Tuple / Array // ❓ children (only for paramType: Tuple / Array to describe their structure) // 🚫 compValue /* 00: */ Pass, // ------------------------------------------------------------ // 01-04: LOGICAL EXPRESSIONS // paramType: None // ✅ children // 🚫 compValue /* 01: */ And, /* 02: */ Or, /* 03: */ Nor, /* 04: */ _Placeholder04, // ------------------------------------------------------------ // 05-14: COMPLEX EXPRESSIONS // paramType: Calldata / AbiEncoded / Tuple / Array, // ✅ children // 🚫 compValue /* 05: */ Matches, /* 06: */ ArraySome, /* 07: */ ArrayEvery, /* 08: */ ArraySubset, /* 09: */ _Placeholder09, /* 10: */ _Placeholder10, /* 11: */ _Placeholder11, /* 12: */ _Placeholder12, /* 13: */ _Placeholder13, /* 14: */ _Placeholder14, // ------------------------------------------------------------ // 15: SPECIAL COMPARISON (without compValue) // paramType: Static // 🚫 children // 🚫 compValue /* 15: */ EqualToAvatar, // ------------------------------------------------------------ // 16-31: COMPARISON EXPRESSIONS // paramType: Static / Dynamic / Tuple / Array // ❓ children (only for paramType: Tuple / Array to describe their structure) // ✅ compValue /* 16: */ EqualTo, // paramType: Static / Dynamic / Tuple / Array /* 17: */ GreaterThan, // paramType: Static /* 18: */ LessThan, // paramType: Static /* 19: */ SignedIntGreaterThan, // paramType: Static /* 20: */ SignedIntLessThan, // paramType: Static /* 21: */ Bitmask, // paramType: Static / Dynamic /* 22: */ Custom, // paramType: Static / Dynamic / Tuple / Array /* 23: */ _Placeholder23, /* 24: */ _Placeholder24, /* 25: */ _Placeholder25, /* 26: */ _Placeholder26, /* 27: */ _Placeholder27, /* 28: */ WithinAllowance, // paramType: Static /* 29: */ EtherWithinAllowance, // paramType: None /* 30: */ CallWithinAllowance, // paramType: None /* 31: */ _Placeholder31 } enum ExecutionOptions { None, Send, DelegateCall, Both } enum Clearance { None, Target, Function } // This struct is a flattened version of Condition // used for ABI encoding a scope config tree // (ABI does not support recursive types) struct ConditionFlat { uint8 parent; ParameterType paramType; Operator operator; bytes compValue; } struct Condition { ParameterType paramType; Operator operator; bytes32 compValue; Condition[] children; } struct ParameterPayload { uint256 location; uint256 size; ParameterPayload[] children; } struct TargetAddress { Clearance clearance; ExecutionOptions options; } struct Role { mapping(address => bool) members; mapping(address => TargetAddress) targets; mapping(bytes32 => bytes32) scopeConfig; } /// @notice The order of members in the `Allowance` struct is significant; members updated during accrual (`balance` and `timestamp`) should be stored in the same word. /// @custom:member refill Amount added to balance after each period elapses. /// @custom:member maxRefill Refilling stops when balance reaches this value. /// @custom:member period Duration, in seconds, before a refill occurs. If set to 0, the allowance is for one-time use and won't be replenished. /// @custom:member balance Remaining allowance available for use. Decreases with usage and increases after each refill by the specified refill amount. /// @custom:member timestamp Timestamp when the last refill occurred. struct Allowance { uint128 refill; uint128 maxRefill; uint64 period; uint128 balance; uint64 timestamp; } struct Consumption { bytes32 allowanceKey; uint128 balance; uint128 consumed; }
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.8.17 <0.9.0; interface ISingletonFactory { function deploy( bytes memory initCode, bytes32 salt ) external returns (address); } library WriteOnce { address public constant SINGLETON_FACTORY = 0xce0042B868300000d44A59004Da54A005ffdcf9f; bytes32 public constant SALT = 0x0000000000000000000000000000000000000000000000000000000000000000; /** @notice Stores `data` and returns `pointer` as key for later retrieval @dev The pointer is a contract address with `data` as code @param data to be written @return pointer Pointer to the written `data` */ function store(bytes memory data) internal returns (address pointer) { bytes memory creationBytecode = creationBytecodeFor(data); pointer = addressFor(creationBytecode); uint256 size; assembly { size := extcodesize(pointer) } if (size == 0) { assert( pointer == ISingletonFactory(SINGLETON_FACTORY).deploy( creationBytecode, SALT ) ); } } /** @notice Reads the contents of the `pointer` code as data, skips the first byte @dev The function is intended for reading pointers generated by `store` @param pointer to be read @return runtimeBytecode read from `pointer` contract */ function load( address pointer ) internal view returns (bytes memory runtimeBytecode) { uint256 rawSize; assembly { rawSize := extcodesize(pointer) } assert(rawSize > 1); // jump over the prepended 00 uint256 offset = 1; // don't count with the 00 uint256 size = rawSize - 1; runtimeBytecode = new bytes(size); assembly { extcodecopy(pointer, add(runtimeBytecode, 32), offset, size) } } function addressFor( bytes memory creationBytecode ) private pure returns (address) { bytes32 hash = keccak256( abi.encodePacked( bytes1(0xff), SINGLETON_FACTORY, SALT, keccak256(creationBytecode) ) ); // get the right most 20 bytes return address(uint160(uint256(hash))); } /** @notice Generate a creation code that results on a contract with `data` as bytecode @param data the buffer to be stored @return creationBytecode (constructor) for new contract */ function creationBytecodeFor( bytes memory data ) private pure returns (bytes memory) { /* 0x00 0x63 0x63XXXXXX PUSH4 _code.length size 0x01 0x80 0x80 DUP1 size size 0x02 0x60 0x600e PUSH1 14 14 size size 0x03 0x60 0x6000 PUSH1 00 0 14 size size 0x04 0x39 0x39 CODECOPY size 0x05 0x60 0x6000 PUSH1 00 0 size 0x06 0xf3 0xf3 RETURN <CODE> */ return abi.encodePacked( hex"63", uint32(data.length + 1), hex"80_60_0E_60_00_39_60_00_F3", // Prepend 00 to data so contract can't be called hex"00", data ); } }
{ "evmVersion": "shanghai", "optimizer": { "enabled": true, "runs": 100 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": { "contracts/Integrity.sol": { "Integrity": "0x6a6af4b16458bc39817e4019fb02bd3b26d41049" }, "contracts/packers/Packer.sol": { "Packer": "0x61c5b1be435391fdd7bc6703f3740c0d11728a8c" } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_avatar","type":"address"},{"internalType":"address","name":"_target","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"module","type":"address"}],"name":"AlreadyDisabledModule","type":"error"},{"inputs":[{"internalType":"address","name":"module","type":"address"}],"name":"AlreadyEnabledModule","type":"error"},{"inputs":[],"name":"ArraysDifferentLength","type":"error"},{"inputs":[],"name":"CalldataOutOfBounds","type":"error"},{"inputs":[{"internalType":"enum PermissionChecker.Status","name":"status","type":"uint8"},{"internalType":"bytes32","name":"info","type":"bytes32"}],"name":"ConditionViolation","type":"error"},{"inputs":[],"name":"FunctionSignatureTooShort","type":"error"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"HashAlreadyConsumed","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[{"internalType":"address","name":"module","type":"address"}],"name":"InvalidModule","type":"error"},{"inputs":[],"name":"InvalidPageSize","type":"error"},{"inputs":[],"name":"MalformedMultiEntrypoint","type":"error"},{"inputs":[],"name":"ModuleTransactionFailed","type":"error"},{"inputs":[],"name":"NoMembership","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"NotAuthorized","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"SetupModulesAlreadyCalled","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"roleKey","type":"bytes32"},{"indexed":false,"internalType":"address","name":"targetAddress","type":"address"},{"indexed":false,"internalType":"bytes4","name":"selector","type":"bytes4"},{"indexed":false,"internalType":"enum ExecutionOptions","name":"options","type":"uint8"}],"name":"AllowFunction","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"roleKey","type":"bytes32"},{"indexed":false,"internalType":"address","name":"targetAddress","type":"address"},{"indexed":false,"internalType":"enum ExecutionOptions","name":"options","type":"uint8"}],"name":"AllowTarget","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"module","type":"address"},{"indexed":false,"internalType":"bytes32[]","name":"roleKeys","type":"bytes32[]"},{"indexed":false,"internalType":"bool[]","name":"memberOf","type":"bool[]"}],"name":"AssignRoles","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousAvatar","type":"address"},{"indexed":true,"internalType":"address","name":"newAvatar","type":"address"}],"name":"AvatarSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"allowanceKey","type":"bytes32"},{"indexed":false,"internalType":"uint128","name":"consumed","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"newBalance","type":"uint128"}],"name":"ConsumeAllowance","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"module","type":"address"}],"name":"DisabledModule","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"module","type":"address"}],"name":"EnabledModule","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"module","type":"address"}],"name":"ExecutionFromModuleFailure","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"module","type":"address"}],"name":"ExecutionFromModuleSuccess","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"","type":"bytes32"}],"name":"HashExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"","type":"bytes32"}],"name":"HashInvalidated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"roleKey","type":"bytes32"},{"indexed":false,"internalType":"address","name":"targetAddress","type":"address"},{"indexed":false,"internalType":"bytes4","name":"selector","type":"bytes4"}],"name":"RevokeFunction","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"roleKey","type":"bytes32"},{"indexed":false,"internalType":"address","name":"targetAddress","type":"address"}],"name":"RevokeTarget","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"initiator","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"avatar","type":"address"},{"indexed":false,"internalType":"address","name":"target","type":"address"}],"name":"RolesModSetup","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"roleKey","type":"bytes32"},{"indexed":false,"internalType":"address","name":"targetAddress","type":"address"},{"indexed":false,"internalType":"bytes4","name":"selector","type":"bytes4"},{"components":[{"internalType":"uint8","name":"parent","type":"uint8"},{"internalType":"enum ParameterType","name":"paramType","type":"uint8"},{"internalType":"enum Operator","name":"operator","type":"uint8"},{"internalType":"bytes","name":"compValue","type":"bytes"}],"indexed":false,"internalType":"struct ConditionFlat[]","name":"conditions","type":"tuple[]"},{"indexed":false,"internalType":"enum ExecutionOptions","name":"options","type":"uint8"}],"name":"ScopeFunction","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"roleKey","type":"bytes32"},{"indexed":false,"internalType":"address","name":"targetAddress","type":"address"}],"name":"ScopeTarget","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"allowanceKey","type":"bytes32"},{"indexed":false,"internalType":"uint128","name":"balance","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"maxRefill","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"refill","type":"uint128"},{"indexed":false,"internalType":"uint64","name":"period","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"timestamp","type":"uint64"}],"name":"SetAllowance","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"module","type":"address"},{"indexed":false,"internalType":"bytes32","name":"defaultRoleKey","type":"bytes32"}],"name":"SetDefaultRole","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"bytes4","name":"selector","type":"bytes4"},{"indexed":false,"internalType":"contract ITransactionUnwrapper","name":"adapter","type":"address"}],"name":"SetUnwrapAdapter","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousTarget","type":"address"},{"indexed":true,"internalType":"address","name":"newTarget","type":"address"}],"name":"TargetSet","type":"event"},{"inputs":[{"internalType":"bytes32","name":"roleKey","type":"bytes32"},{"internalType":"address","name":"targetAddress","type":"address"},{"internalType":"bytes4","name":"selector","type":"bytes4"},{"internalType":"enum ExecutionOptions","name":"options","type":"uint8"}],"name":"allowFunction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"roleKey","type":"bytes32"},{"internalType":"address","name":"targetAddress","type":"address"},{"internalType":"enum ExecutionOptions","name":"options","type":"uint8"}],"name":"allowTarget","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"allowances","outputs":[{"internalType":"uint128","name":"refill","type":"uint128"},{"internalType":"uint128","name":"maxRefill","type":"uint128"},{"internalType":"uint64","name":"period","type":"uint64"},{"internalType":"uint128","name":"balance","type":"uint128"},{"internalType":"uint64","name":"timestamp","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"module","type":"address"},{"internalType":"bytes32[]","name":"roleKeys","type":"bytes32[]"},{"internalType":"bool[]","name":"memberOf","type":"bool[]"}],"name":"assignRoles","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"avatar","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"consumed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"defaultRoles","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"prevModule","type":"address"},{"internalType":"address","name":"module","type":"address"}],"name":"disableModule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"module","type":"address"}],"name":"enableModule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"enum Enum.Operation","name":"operation","type":"uint8"}],"name":"execTransactionFromModule","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"enum Enum.Operation","name":"operation","type":"uint8"}],"name":"execTransactionFromModuleReturnData","outputs":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"enum Enum.Operation","name":"operation","type":"uint8"},{"internalType":"bytes32","name":"roleKey","type":"bytes32"},{"internalType":"bool","name":"shouldRevert","type":"bool"}],"name":"execTransactionWithRole","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"enum Enum.Operation","name":"operation","type":"uint8"},{"internalType":"bytes32","name":"roleKey","type":"bytes32"},{"internalType":"bool","name":"shouldRevert","type":"bool"}],"name":"execTransactionWithRoleReturnData","outputs":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"start","type":"address"},{"internalType":"uint256","name":"pageSize","type":"uint256"}],"name":"getModulesPaginated","outputs":[{"internalType":"address[]","name":"array","type":"address[]"},{"internalType":"address","name":"next","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"hash","type":"bytes32"}],"name":"invalidate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_module","type":"address"}],"name":"isModuleEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes32","name":"salt","type":"bytes32"}],"name":"moduleTxHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"roleKey","type":"bytes32"},{"internalType":"address","name":"targetAddress","type":"address"},{"internalType":"bytes4","name":"selector","type":"bytes4"}],"name":"revokeFunction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"roleKey","type":"bytes32"},{"internalType":"address","name":"targetAddress","type":"address"}],"name":"revokeTarget","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"roleKey","type":"bytes32"},{"internalType":"address","name":"targetAddress","type":"address"},{"internalType":"bytes4","name":"selector","type":"bytes4"},{"components":[{"internalType":"uint8","name":"parent","type":"uint8"},{"internalType":"enum ParameterType","name":"paramType","type":"uint8"},{"internalType":"enum Operator","name":"operator","type":"uint8"},{"internalType":"bytes","name":"compValue","type":"bytes"}],"internalType":"struct ConditionFlat[]","name":"conditions","type":"tuple[]"},{"internalType":"enum ExecutionOptions","name":"options","type":"uint8"}],"name":"scopeFunction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"roleKey","type":"bytes32"},{"internalType":"address","name":"targetAddress","type":"address"}],"name":"scopeTarget","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"key","type":"bytes32"},{"internalType":"uint128","name":"balance","type":"uint128"},{"internalType":"uint128","name":"maxRefill","type":"uint128"},{"internalType":"uint128","name":"refill","type":"uint128"},{"internalType":"uint64","name":"period","type":"uint64"},{"internalType":"uint64","name":"timestamp","type":"uint64"}],"name":"setAllowance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_avatar","type":"address"}],"name":"setAvatar","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"module","type":"address"},{"internalType":"bytes32","name":"roleKey","type":"bytes32"}],"name":"setDefaultRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_target","type":"address"}],"name":"setTarget","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes4","name":"selector","type":"bytes4"},{"internalType":"contract ITransactionUnwrapper","name":"adapter","type":"address"}],"name":"setTransactionUnwrapper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"initParams","type":"bytes"}],"name":"setUp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"target","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"unwrappers","outputs":[{"internalType":"contract ITransactionUnwrapper","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801562000010575f80fd5b506040516200630a3803806200630a83398101604081905262000033916200035a565b604080516001600160a01b038581166020830152848116828401528316606080830191909152825180830390910181526080909101909152620000768162000080565b50505050620003ab565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000810460ff1615906001600160401b03165f81158015620000ca5750825b90505f826001600160401b03166001148015620000e65750303b155b905081158015620000f5575080155b15620001145760405163f92ee8a960e01b815260040160405180910390fd5b84546001600160401b031916600117855583156200014357845460ff60401b1916680100000000000000001785555b5f805f888060200190518101906200015c91906200035a565b919450925090506200016e8362000240565b5f80546001600160a01b038085166001600160a01b0319928316179092556001805492841692909116919091179055620001a7620002b0565b6040516001600160a01b038281168252808416919085169033907f34d3b96a088381c6843a1f9d94d251afa88f83cc7a0d17fc23a7057506a3fc6d9060200160405180910390a450505083156200023857845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a3505050565b60015f5260036020527fa15bc60c955c405d20d9149c709e2460f1c2d9a497496a7f46004d1772c3054c546001600160a01b031615620003035760405163dfd49ebd60e01b815260040160405180910390fd5b60015f81905260036020527fa15bc60c955c405d20d9149c709e2460f1c2d9a497496a7f46004d1772c3054c80546001600160a01b0319169091179055565b6001600160a01b038116811462000357575f80fd5b50565b5f805f606084860312156200036d575f80fd5b83516200037a8162000342565b60208501519093506200038d8162000342565b6040850151909250620003a08162000342565b809150509250925092565b615f5180620003b95f395ff3fe608060405234801561000f575f80fd5b50600436106101ab575f3560e01c80637508dd98116100eb578063b3dd25c71161008f578063b3dd25c71461044a578063c6fe87471461045d578063cc2f845214610470578063d4b8399214610491578063d8afba76146104a4578063e009cfde146104b7578063e29dfba8146104ca578063f2fde38b146104f7575f80fd5b80637508dd98146103bd578063776d1a01146103d05780637b0da5b2146103e35780638da5cb5b146103f6578063946d364e146103fe578063957ed2b314610411578063a4f9edbf14610424578063a8ec43ee14610437575f80fd5b8063468721a711610152578063468721a7146102ac5780635229073f146102bf5780635aef7de6146102d25780635e7c9fe8146102e4578063610b59251461037c57806366523f7d1461038f57806369ecc3cf146103a2578063715018a6146103b5575f80fd5b80630172a43a146101af578063086cfca8146101c45780630c6c76b8146101d75780632916a9af146101ea5780632959513c146101fd5780632b99e5061461023b5780632d3c25471461025c5780632d9ad53d14610289575b5f80fd5b6101c26101bd366004614d45565b61050a565b005b6101c26101d2366004614d73565b6105e0565b6101c26101e5366004614d45565b610637565b6101c26101f8366004614da5565b61070b565b61022561020b366004614deb565b60066020525f90815260409020546001600160a01b031681565b6040516102329190614e02565b60405180910390f35b61024e610249366004614e6c565b6107b0565b604051610232929190614f42565b61027b61026a366004614d73565b60076020525f908152604090205481565b604051908152602001610232565b61029c610297366004614d73565b610854565b6040519015158152602001610232565b61029c6102ba366004614f5c565b61088d565b61024e6102cd366004614f5c565b61090f565b5f54610225906001600160a01b031681565b61033d6102f2366004614deb565b60056020525f9081526040902080546001909101546001600160801b0380831692600160801b90048116916001600160401b0380821692600160401b83041691600160c01b90041685565b604080516001600160801b03968716815294861660208601526001600160401b039384169085015293166060830152909116608082015260a001610232565b6101c261038a366004614d73565b610998565b6101c261039d366004614fca565b610aa7565b6101c26103b0366004614deb565b610b31565b6101c2610b83565b6101c26103cb366004615140565b610b96565b6101c26103de366004614d73565b610c69565b6101c26103f13660046152b3565b610cc2565b610225610d9d565b6101c261040c3660046152e5565b610dcb565b6101c261041f36600461534f565b610e23565b6101c26104323660046153cb565b610f38565b6101c2610445366004615428565b6110f1565b6101c2610458366004615491565b6112ea565b61029c61046b366004614e6c565b61136a565b61048361047e3660046152e5565b611408565b6040516102329291906154dd565b600154610225906001600160a01b031681565b61027b6104b2366004615539565b611598565b6101c26104c5366004615580565b6116b6565b61029c6104d83660046152e5565b600260209081525f928352604080842090915290825290205460ff1681565b6101c2610505366004614d73565b6117ad565b6105126117ea565b6040805180820182525f8082526020808301829052858252600481528382206001600160a01b0386168352600190810190915292902081518154929391929091839160ff19169083600281111561056b5761056b6155ac565b021790555060208201518154829061ff001916610100836003811115610593576105936155ac565b021790555050604080518481526001600160a01b03841660208201527f3ccf62aacc3286173cedf5c20ec550071636a2faf0a3b28d93841736a43f822b9250015b60405180910390a15050565b6105e86117ea565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f52ae88b092de36f87fb43fe794eb1381023b9c1bce563a871154022c63dce3429190a35050565b61063f6117ea565b6040805180820190915280600281526020015f90525f8381526004602090815260408083206001600160a01b038616845260019081019092529091208251815491929091839160ff199091169083600281111561069e5761069e6155ac565b021790555060208201518154829061ff0019166101008360038111156106c6576106c66155ac565b021790555050604080518481526001600160a01b03841660208201527f277465b84f512b759d745fab70327b693ee21ce592fca91a3f491739a25fa76a9250016105d4565b6107136117ea565b60a082901c63ffffffff60401b16606084811b6001600160601b031916919091175f9081526006602090815260409182902080546001600160a01b0319166001600160a01b03868116918217909255835191881682526001600160e01b0319871692820192909252918201527f1330d96b64c7e86736f77e027ca34223dd3d1d08049281281c9d597d8098ed5991015b60405180910390a1505050565b5f60605f6107c2858b8b8b8b8b61181c565b90506107cd81611a77565b61080f8a8a8a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152508c9250611bd0915050565b909350915083801561081f575082155b1561083d5760405163d27b44a960e01b815260040160405180910390fd5b6108478184611c5a565b5097509795505050505050565b5f60016001600160a01b0383161480159061088757506001600160a01b038281165f908152600360205260409020541615155b92915050565b335f9081526007602052604081205481906108ac90888888888861181c565b90506108b781611a77565b6108f9878787878080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250899250611d46915050565b91506109058183611c5a565b5095945050505050565b335f90815260076020526040812054606090829061093190898989898961181c565b905061093c81611a77565b61097e888888888080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152508a9250611bd0915050565b909350915061098d8184611c5a565b509550959350505050565b6109a06117ea565b6001600160a01b03811615806109bf57506001600160a01b0381166001145b156109e85780604051635c93ff2f60e11b81526004016109df9190614e02565b60405180910390fd5b6001600160a01b038181165f908152600360205260409020541615610a225780604051632061897360e01b81526004016109df9190614e02565b60036020525f80516020615efc83398151915280546001600160a01b038381165f81815260408082208054949095166001600160a01b03199485161790945560019052835490911617909155517fecdf3a3effea5783a3c4c2140e677577666428d44ed9d474a0b3a4c9943f844090610a9c908390614e02565b60405180910390a150565b610aaf6117ea565b5f83815260046020526040812060020190610aca8484611dc7565b81526020019081526020015f205f90557f32a3a599b308fc900a0e6513db2ad40bf0c94367da90048a4b308d8c6b2dd6ea8383836040516107a3939291909283526001600160a01b039190911660208301526001600160e01b031916604082015260600190565b335f908152600260209081526040808320848452825291829020805460ff1916600117905590518281527f89a77869d7b8125ba16e08a92ddc8cc26fb1fa47241971167954489a5e66c2559101610a9c565b610b8b6117ea565b610b945f611de7565b565b610b9e6117ea565b60405163783a904760e01b8152736a6af4b16458bc39817e4019fb02bd3b26d410499063783a904790610bd59085906004016155e4565b5f6040518083038186803b158015610beb575f80fd5b505af4158015610bfd573d5f803e3d5ffd5b5050505f868152600460205260409020610c239150610c1c8686611dc7565b8484611e57565b7f4f6c340456f64db31a3d003c1224ba1de058557b1cdf71f21ae48ce4a4f64f528585858585604051610c5a959493929190615691565b60405180910390a15050505050565b610c716117ea565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f90cc2f570a6eb594b1580ea3e41247d2d73a55281889e86bd4ec2fc29c7e62d6905f90a35050565b610cca6117ea565b604080518082019091528060018152602001826003811115610cee57610cee6155ac565b90525f8481526004602090815260408083206001600160a01b038716845260019081019092529091208251815491929091839160ff1990911690836002811115610d3a57610d3a6155ac565b021790555060208201518154829061ff001916610100836003811115610d6257610d626155ac565b02179055509050507f05e4ec9b54e94ad676ef61d57214f6d57d752ed2022dea5e5f956d5df7ccb2508383836040516107a39392919061575d565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031690565b610dd36117ea565b6001600160a01b0382165f81815260076020908152604091829020849055815192835282018390527f60c85b61661a191efceebca036d48b290e04a1f08dd96472b920adbdd50c64e891016105d4565b610e2b6117ea565b828114610e4b576040516374f4d53760e01b815260040160405180910390fd5b5f5b61ffff8116841115610eea5782828261ffff16818110610e6f57610e6f615780565b9050602002016020810190610e849190615794565b60045f87878561ffff16818110610e9d57610e9d615780565b602090810292909201358352508181019290925260409081015f9081206001600160a01b038b1682529092529020805460ff1916911515919091179055610ee3816157c3565b9050610e4d565b50610ef485610854565b610f0157610f0185610998565b7f9f8368fa4ddcbd561efd7ad2a2174235bf5b840a73fb18f20db9705c114624988585858585604051610c5a9594939291906157e3565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b03165f81158015610f7c5750825b90505f826001600160401b03166001148015610f975750303b155b905081158015610fa5575080155b15610fc35760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315610fed57845460ff60401b1916600160401b1785555b5f805f888060200190518101906110049190615872565b92509250925061101383611de7565b5f80546001600160a01b038085166001600160a01b031992831617909255600180549284169290911691909117905561104a611f06565b816001600160a01b0316836001600160a01b0316336001600160a01b03167f34d3b96a088381c6843a1f9d94d251afa88f83cc7a0d17fc23a7057506a3fc6d846040516110979190614e02565b60405180910390a450505083156110e957845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2906020015b60405180910390a15b505050505050565b6110f96117ea565b836001600160801b03165f03611116576001600160801b03611118565b835b9350806001600160401b03165f036111305742611132565b805b90506040518060a00160405280846001600160801b03168152602001856001600160801b03168152602001836001600160401b03168152602001866001600160801b03168152602001826001600160401b031681525060055f8881526020019081526020015f205f820151815f015f6101000a8154816001600160801b0302191690836001600160801b031602179055506020820151815f0160106101000a8154816001600160801b0302191690836001600160801b031602179055506040820151816001015f6101000a8154816001600160401b0302191690836001600160401b0316021790555060608201518160010160086101000a8154816001600160801b0302191690836001600160801b0316021790555060808201518160010160186101000a8154816001600160401b0302191690836001600160401b031602179055509050507f63d7ec44a20b176da1d60d75259d264ee67b3d8213706afa71a28f69ed8ebece8686868686866040516110e0969594939291909586526001600160801b0394851660208701529284166040860152921660608401526001600160401b0391821660808401521660a082015260c00190565b6112f26117ea565b6112fb81611f71565b5f858152600460205260408120600201906113168686611dc7565b81526020019081526020015f20819055507f9603b65b11492fec54ccc3d9feb93536f804d82e12228187ff730a253fc283ee8484848460405161135c94939291906158b1565b60405180910390a150505050565b5f8061137a848a8a8a8a8a61181c565b905061138581611a77565b6113c7898989898080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152508b9250611d46915050565b91508280156113d4575081155b156113f25760405163d27b44a960e01b815260040160405180910390fd5b6113fc8183611c5a565b50979650505050505050565b60605f6001600160a01b03841660011480159061142b575061142984610854565b155b1561144b5783604051635c93ff2f60e11b81526004016109df9190614e02565b825f0361146b576040516372dbed9760e11b815260040160405180910390fd5b826001600160401b0381111561148357611483614ffc565b6040519080825280602002602001820160405280156114ac578160200160208202803683370190505b506001600160a01b038086165f90815260036020526040812054929450911691505b6001600160a01b038216158015906114f057506001600160a01b038216600114155b80156114fb57508381105b15611555578183828151811061151357611513615780565b6001600160a01b039283166020918202929092018101919091529281165f9081526003909352604090922054909116908061154d816158e4565b9150506114ce565b6001600160a01b03821660011461158d57826115726001836158fc565b8151811061158257611582615780565b602002602001015191505b808352509250929050565b604080517f47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a79469218602082015246918101919091523060608201525f9081906080016040516020818303038152906040528051906020012090505f601960f81b600160f81b837f2939aeeda3ca260200c9f7b436b19e13207547ccc65cfedc857751c5ea6d91d45f1b898960405161162e92919061590f565b6040805191829003822060208301939093528101919091526060810188905260800160408051808303601f190181529082905280516020918201206001600160f81b0319958616918301919091529290931660218401526022830152604282015260620160408051601f198184030181529190528051602090910120925050505b9392505050565b6116be6117ea565b6001600160a01b03811615806116dd57506001600160a01b0381166001145b156116fd5780604051635c93ff2f60e11b81526004016109df9190614e02565b6001600160a01b038281165f9081526003602052604090205481169082161461173b5780604051638b4189ff60e01b81526004016109df9190614e02565b6001600160a01b038181165f81815260036020526040808220805487861684528284208054919096166001600160a01b0319918216179095559290915281549092169055517faab4fa2b463f581b2b32cb3b7e3b704b9ce37cc209b5fb4d77e593ace4054276906105d4908390614e02565b6117b56117ea565b6001600160a01b0381166117de575f604051631e4fbdf760e01b81526004016109df9190614e02565b6117e781611de7565b50565b336117f3610d9d565b6001600160a01b031614610b94573360405163118cdaa760e01b81526004016109df9190614e02565b335f908152600360205260409020546060906001600160a01b031661192c575f80611845611f94565b6001600160a01b038082165f90815260036020526040902054929450909250166118845733604051634a0bfec160e01b81526004016109df9190614e02565b6001600160a01b0381165f90815260026020908152604080832085845290915290205460ff16156118cb57604051639e1dc0c560e01b8152600481018390526024016109df565b6001600160a01b0381165f908152600260209081526040808320858452825291829020805460ff1916600117905590518381527f8c8e19e7e8e193118a05465d7676e82215052d3cb150628fbf598105dc2bb6ab910160405180910390a150505b5f87900361194d57604051631fb1d3e560e31b815260040160405180910390fd5b5f8781526004602052604081209081906119656120ef565b6001600160a01b0316815260208101919091526040015f205460ff1661199e57604051631fb1d3e560e31b815260040160405180910390fd5b5f6119e4886119ad878961591e565b60a01c63ffffffff60401b1660609190911b6001600160601b031916175f908152600660205260409020546001600160a01b031690565b90505f6119ef614ce1565b6001600160a01b038316611a1957611a0f848b8b8b8b8b875f015161214a565b9092509050611a2e565b611a2883858c8c8c8c8c612398565b90925090505b5f826013811115611a4157611a416155ac565b14611a66576020810151604051631a1537eb60e31b81526109df91849160040161594e565b5193505050505b9695505050505050565b80515f5b81811015611bcb575f838281518110611a9657611a96615780565b60209081029190910181015180516040808301515f83815260058652828120835160a08101855281546001600160801b038082168352600160801b90910481169882019890985260018201546001600160401b0380821696830196909652600160401b81049098166060820152600160c01b90970490931660808701529395509193919290918190611b2890426124dd565b9150915085602001516001600160801b0316826001600160801b031614611b5157611b5161596c565b816001600160801b0316846001600160801b03161115611b7357611b7361596c565b611b7d8483615980565b600193840180546001600160401b03938416600160c01b026001600160c01b036001600160801b0394909416600160401b029390931693169290921717905550939093019250611a7b915050565b505050565b600154604051635229073f60e01b81525f916060916001600160a01b0390911690635229073f90611c0b9089908990899089906004016159b0565b5f604051808303815f875af1158015611c26573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611c4d9190810190615a27565b9150915094509492505050565b81515f5b81811015611d40575f848281518110611c7957611c79615780565b602002602001015190505f815f015190508415611cf657604082015160208301517f90355d540c2980efb4c360996dfc5405ee87e812e4f3db843857547cbdb5af65918391611cc9908290615980565b604080519384526001600160801b03928316602085015291169082015260600160405180910390a1611d36565b6020808301515f8381526005909252604090912060010180546001600160801b03909216600160401b02600160401b600160c01b03199092169190911790555b5050600101611c5e565b50505050565b60015460405163468721a760e01b81525f916001600160a01b03169063468721a790611d7c9088908890889088906004016159b0565b6020604051808303815f875af1158015611d98573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611dbc9190615a6a565b90505b949350505050565b60a01c63ffffffff60401b1660609190911b6001600160601b0319161790565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a3505050565b604051634031b16960e11b81525f907361c5b1be435391fdd7bc6703f3740c0d11728a8c9063806362d290611e909086906004016155e4565b5f60405180830381865af4158015611eaa573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611ed19190810190615a85565b90505f611edd82612600565b9050611eeb84518483612719565b5f958652600290960160205250506040909220929092555050565b60015f5260036020525f80516020615efc833981519152546001600160a01b031615611f455760405163dfd49ebd60e01b815260040160405180910390fd5b60015f81905260036020525f80516020615efc83398151915280546001600160a01b0319169091179055565b5f600160d81b60e0836003811115611f8b57611f8b6155ac565b901b1792915050565b5f8080366065811015611fac57505f93849350915050565b5f805f611fb9858561274a565b919450925090505f611fcc6061866158fc565b90505f611fdb8683818a615ab6565b611fe491615add565b90508460ff165f0361206a57826004811080611fff57508281115b1561201557505f998a9950975050505050505050565b845f61202c61202684838c8e615ab6565b86611598565b905061204a82828c8c87908a9261204593929190615ab6565b6127c0565b612055575f80612058565b80825b9b509b50505050505050505050509091565b5f61208061207a84838a8c615ab6565b84611598565b604080515f81526020810180835283905260ff8916918101919091526060810187905260808101869052909150819060019060a0016020604051602081039080840390855afa1580156120d5573d5f803e3d5ffd5b505050602060405103519950995050505050505050509091565b335f908152600360205260408120546001600160a01b03161561211157503390565b5f61211a611f94565b6001600160a01b038082165f908152600360205260409020549193501615905061214357919050565b5f91505090565b5f612153614ce1565b84158015906121625750600485105b1561218057604051632342609160e11b815260040160405180910390fd5b60026001600160a01b0389165f90815260018b01602052604090205460ff1660028111156121b0576121b06155ac565b036122f2575f6121c9896121c4888a61591e565b611dc7565b5f81815260028c01602052604081205491925081900361221b57600360405180604001604052808781526020018a8a90612203919061591e565b6001600160e01b03191681525093509350505061238c565b5f80612226836128a2565b915091505f6122368c8a846128cc565b90505f81601381111561224b5761224b6155ac565b1461227257604080518082019091528881525f6020820152909650945061238c9350505050565b821561229e575f60405180604001604052808a81526020015f801b81525096509650505050505061238c565b505050506122e88a82898960405180608001604052808f6001600160a01b031681526020018e81526020018a81526020018b60018111156122e1576122e16155ac565b9052612980565b925092505061238c565b60016001600160a01b0389165f90815260018b01602052604090205460ff166002811115612322576123226155ac565b03612373576001600160a01b0388165f90815260018a0160205260409020546123569088908690610100900460ff166128cc565b604080518082019091528481525f6020820152909250905061238c565b5050604080518082019091528181525f60208201526002905b97509795505050505050565b5f6123a1614ce1565b60405163c7a7b63560e01b81526001600160a01b038a169063c7a7b635906123d5908a908a908a908a908a90600401615b22565b5f60405180830381865afa92505050801561241157506040513d5f823e601f3d908101601f1916820160405261240e9190810190615b58565b60015b61242e576040516315e649e960e01b815260040160405180910390fd5b5f5b81518110156124cf575f82828151811061244c5761244c615780565b602002602001015190505f816060015190505f82608001518261246f9190615c29565b905061249a8d846020015185604001518d8d8790879261249193929190615ab6565b88518c5161214a565b90975095505f8760138111156124b2576124b26155ac565b146124c157505050505061238c565b836001019350505050612430565b505097509795505050505050565b5f8083604001516001600160401b03165f148061251e5750836040015184608001516125099190615c3c565b6001600160401b0316836001600160401b0316105b15612534575050606082015160808301516125f9565b5f846040015185608001518561254a9190615c5c565b6125549190615c90565b905084602001516001600160801b031685606001516001600160801b031610156125cf57845161258e906001600160401b03831690615cb5565b856060015161259d9190615cd8565b925084602001516001600160801b0316836001600160801b0316106125c65784602001516125c8565b825b92506125d7565b846060015192505b60408501516125e69082615cf8565b85608001516125f59190615c3c565b9150505b9250929050565b5f8061260b836129eb565b905061266d818051602091820120604080516001600160f81b03198185015273ce0042b868300000d44a59004da54a005ffdcf9f60601b60218201525f6035820152605580820193909352815180820390930183526075019052805191012090565b9150813b5f8190036127125760405163257b1f8160e11b815273ce0042b868300000d44a59004da54a005ffdcf9f90634af63f02906126b29085905f90600401615d1b565b6020604051808303815f875af11580156126ce573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906126f29190615d3c565b6001600160a01b0316836001600160a01b0316146127125761271261596c565b5050919050565b5f6001600160a01b03821660e0846003811115612738576127386155ac565b60f087901b911b171790509392505050565b5f8080848461275a6001826158fc565b612765928290615ab6565b61276e91615d57565b60f81c925084846127806041826158fc565b61278b928290615ab6565b61279491615add565b915084846127a36021826158fc565b6127ae928290615ab6565b6127b791615add565b90509250925092565b5f843b8082036127d3575f915050611dbf565b5f866001600160a01b0316631626ba7e60e01b8787876040516024016127fb93929190615d85565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516128399190615d9e565b5f60405180830381855afa9150503d805f8114612871576040519150601f19603f3d011682016040523d82523d5f602084013e612876565b606091505b509150630b135d3f60e11b905061288c82615db9565b6001600160e01b03191614979650505050505050565b600160d81b811615155f60e083901c60ff1660038111156128c5576128c56155ac565b9050915091565b5f80841180156128ee575060018260038111156128eb576128eb6155ac565b14155b801561290c57506003826003811115612909576129096155ac565b14155b15612919575060046116af565b600183600181111561292d5761292d6155ac565b14801561294c57506002826003811115612949576129496155ac565b14155b801561296a57506003826003811115612967576129676155ac565b14155b15612977575060016116af565b505f9392505050565b5f612989614ce1565b5f806129958989612a23565b915091505f6129a5888885612bea565b90505f866040015151116129b957816129c7565b6129c7866040015183612c3f565b60408701526129d9888885848a612f65565b945094505050505b9550959350505050565b6060815160016129fb9190615c29565b82604051602001612a0d929190615df0565b6040516020818303038152906040529050919050565b612a4c6040805160808101909152805f81526020015f81525f6020820152606060409091015290565b5f82815260028401602052604081205460609160f082901c916001600160a01b031690612a788261320b565b90505f80612a868386613283565b915091505f805b8351811015612baa575f848281518110612aa957612aa9615780565b6020026020010151604001519050601c601f811115612aca57612aca6155ac565b81601f811115612adc57612adc6155ac565b10612af157612aea836158e4565b9250612ba1565b600f81601f811115612b0557612b056155ac565b03612ba1576010858381518110612b1e57612b1e615780565b602002602001015160400190601f811115612b3b57612b3b6155ac565b9081601f811115612b4e57612b4e6155ac565b9052505f54604051612b6c916001600160a01b031690602001614e02565b60405160208183030381529060405280519060200120848381518110612b9457612b94615780565b6020026020010181815250505b50600101612a8d565b50612bc08383612bb986613473565b5f8c6135b6565b875f8211612bce5787612bd9565b612bd984848461378c565b975097505050505050509250929050565b612c0c60405180606001604052805f81526020015f8152602001606081525090565b5f612c1683613972565b9050612c2d85856004848560200151515f88613afe565b505f8152602081019290925250919050565b606082515f03612c50575080610887565b81515f03612c5f575081610887565b81518351612c6d9190615c29565b6001600160401b03811115612c8457612c84614ffc565b604051908082528060200260200182016040528015612ccd57816020015b604080516060810182525f80825260208083018290529282015282525f19909201910181612ca25790505b5083519091505f5b81811015612dc357848181518110612cef57612cef615780565b60200260200101515f0151838281518110612d0c57612d0c615780565b60200260200101515f018181525050848181518110612d2d57612d2d615780565b602002602001015160200151838281518110612d4b57612d4b615780565b6020026020010151602001906001600160801b031690816001600160801b031681525050848181518110612d8157612d81615780565b602002602001015160400151838281518110612d9f57612d9f615780565b60209081029190910101516001600160801b03909116604090910152600101612cd5565b505f5b8351811015612f50575f80612df787878581518110612de757612de7615780565b60200260200101515f0151613ca9565b915091508015612e5a57858381518110612e1357612e13615780565b602002602001015160400151858381518110612e3157612e31615780565b6020026020010151604001818151612e499190615cd8565b6001600160801b0316905250612f46565b858381518110612e6c57612e6c615780565b60200260200101515f0151858581518110612e8957612e89615780565b60200260200101515f018181525050858381518110612eaa57612eaa615780565b602002602001015160200151858581518110612ec857612ec8615780565b6020026020010151602001906001600160801b031690816001600160801b031681525050858381518110612efe57612efe615780565b602002602001015160400151858581518110612f1c57612f1c615780565b60209081029190910101516001600160801b0390911660409091015283612f42816158e4565b9450505b5050600101612dc6565b508151811015612f5e578082525b5092915050565b5f612f6e614ce1565b6020850151601081601f811115612f8757612f876155ac565b10156130e1575f81601f811115612fa057612fa06155ac565b03612fc55750506040805180820182529083015181525f6020820181905291506129e1565b600581601f811115612fd957612fd96155ac565b03612ff557612feb8888888888613cfe565b92509250506129e1565b600181601f811115613009576130096155ac565b0361301b57612feb8888888888613e19565b600281601f81111561302f5761302f6155ac565b0361304157612feb8888888888613ee9565b600381601f811115613055576130556155ac565b0361306757612feb8888888888613f71565b600681601f81111561307b5761307b6155ac565b0361308d57612feb8888888888614019565b600781601f8111156130a1576130a16155ac565b036130b357612feb8888888888614110565b600881601f8111156130c7576130c76155ac565b146130d4576130d461596c565b612feb888888888861418f565b601281601f8111156130f5576130f56155ac565b11613127576131068888888861430a565b6040805180820182529086015181525f602082015290935091506129e19050565b601481601f81111561313b5761313b6155ac565b1161314c5761310688888888614411565b601581601f811115613160576131606155ac565b036131715761310688888888614493565b601681601f811115613185576131856155ac565b0361319757612feb888888888861456e565b601c81601f8111156131ab576131ab6155ac565b036131bd57612feb8888888888614653565b601d81601f8111156131d1576131d16155ac565b036131e057612feb868561468d565b601e81601f8111156131f4576131f46155ac565b146132015761320161596c565b612feb86856146d8565b6060813b6001811161321f5761321f61596c565b60015f61322c82846158fc565b9050806001600160401b0381111561324657613246614ffc565b6040519080825280601f01601f191660200182016040528015613270576020820181803683370190505b509350808260208601873c505050919050565b606080826001600160401b0381111561329e5761329e614ffc565b6040519080825280602002602001820160405280156132d757816020015b6132c4614cf8565b8152602001906001900390816132bc5790505b509150826001600160401b038111156132f2576132f2614ffc565b60405190808252806020026020018201604052801561331b578160200160208202803683370190505b5090505f60208161332d600287615e46565b613338906020615c29565b90505f5b8681101561346857878301519350613355600284615c29565b92505f8460f01c90505f87838151811061337157613371615780565b6020908102919091010151600883901c60ff1681529050600582901c60071660068111156133a1576133a16155ac565b816020019060068111156133b7576133b76155ac565b908160068111156133ca576133ca6155ac565b905250601f828116908111156133e2576133e26155ac565b8160400190601f8111156133f8576133f86155ac565b9081601f81111561340b5761340b6155ac565b90525060108160400151601f811115613426576134266155ac565b1061345e5789840151955061343c602085615c29565b93508587848151811061345157613451615780565b6020026020010181815250505b505060010161333c565b505050509250929050565b8051606090806134855761348561596c565b806001600160401b0381111561349d5761349d614ffc565b6040519080825280602002602001820160405280156134ef57816020015b6134dc60405180606001604052805f81526020015f81526020015f81525090565b8152602001906001900390816134bb5790505b5091505f19825f8151811061350657613506615780565b60209081029190910101515260015b81811015612712575f1983828151811061353157613531615780565b60200260200101515f0181815250505f8385838151811061355457613554615780565b60200260200101515f015160ff168151811061357257613572615780565b602002602001015190505f19815f01510361358b578181525b613596826001615c29565b6020820181905281516135a8916158fc565b604090910152600101613515565b5f8583815181106135c9576135c9615780565b602002602001015190508060200151825f019060068111156135ed576135ed6155ac565b90816006811115613600576136006155ac565b90525060408101516020830190601f81111561361e5761361e6155ac565b9081601f811115613631576136316155ac565b8152505084838151811061364757613647615780565b602002602001015182604001818152505083838151811061366a5761366a615780565b6020026020010151604001515f036136825750613785565b5f84848151811061369557613695615780565b60200260200101515f015190505f8585815181106136b5576136b5615780565b6020026020010151604001519050806001600160401b038111156136db576136db614ffc565b60405190808252806020026020018201604052801561373557816020015b6137226040805160808101909152805f81526020015f81525f6020820152606060409091015290565b8152602001906001900390816136f95790505b5060608501525f5b81811015613780576137788989896137558588615c29565b8960600151868151811061376b5761376b615780565b60200260200101516135b6565b60010161373d565b505050505b5050505050565b8251606090826001600160401b038111156137a9576137a9614ffc565b6040519080825280602002602001820160405280156137f257816020015b604080516060810182525f80825260208083018290529282015282525f199092019101816137c75790505b5091505f805b8281101561395c57601c87828151811061381457613814615780565b602002602001015160400151601f811115613831576138316155ac565b1061394c575f86828151811061384957613849615780565b602002602001015190505f61385e8683613ca9565b915050801561386e57505061394c565b8186858151811061388157613881615780565b602090810291909101810151919091525f83815260058252604090819020815160a08101835281546001600160801b038082168352600160801b9091048116948201949094526001909101546001600160401b0380821693830193909352600160401b81049093166060820152600160c01b90920416608082015261390690426124dd565b5086858151811061391957613919615780565b6020026020010151602001816001600160801b03166001600160801b0316815250508380613946906158e4565b94505050505b613955816158e4565b90506137f8565b5083811015613969578083525b50509392505050565b61397a614d20565b60018260200151601f811115613992576139926155ac565b101580156139b6575060038260200151601f8111156139b3576139b36155ac565b11155b156139f5575f826060015151116139cf576139cf61596c565b61088782606001515f815181106139e8576139e8615780565b6020026020010151613972565b815181906006811115613a0a57613a0a6155ac565b90816006811115613a1d57613a1d6155ac565b90525060608201515115613af9575f600483516006811115613a4157613a416155ac565b14613a5157826060015151613a54565b60015b9050806001600160401b03811115613a6e57613a6e614ffc565b604051908082528060200260200182016040528015613aa757816020015b613a94614d20565b815260200190600190039081613a8c5790505b5060208301525f5b8181101561271257613ad0846060015182815181106139e8576139e8615780565b83602001518281518110613ae657613ae6615780565b6020908102919091010152600101613aaf565b919050565b826001600160401b03811115613b1657613b16614ffc565b604051908082528060200260200182016040528015613b6957816020015b613b5660405180606001604052805f81526020015f8152602001606081525090565b815260200190600190039081613b345790505b5060408201525f8215613b9f57613b9c85602001515f81518110613b8f57613b8f615780565b6020026020010151614715565b90505b5f805b85811015613c9d5784613bcb57613bc887602001518281518110613b8f57613b8f615780565b92505b613c2a8a8a613bdd8d8d8d888a6147fb565b8a6020015189613bed5785613bef565b5f5b81518110613bff57613bff615780565b602002602001015188604001518681518110613c1d57613c1d615780565b6020026020010151614838565b5f84604001518281518110613c4157613c41615780565b602002602001015160200151905083613c6457613c5f816020615c29565b613c66565b805b85602001818151613c779190615c29565b90525083613c86576020613c88565b805b613c929084615c29565b925050600101613ba2565b50505050505050505050565b81515f908190815b81811015613cf15784868281518110613ccc57613ccc615780565b60200260200101515f015103613ce9579250600191506125f99050565b600101613cb1565b505f958695509350505050565b5f613d07614ce1565b60408084015182528401515160608601515114613d2757600a91506129e1565b5f5b856060015151811015613e0b57613dc4888888606001518481518110613d5157613d51615780565b602002602001015188604001518581518110613d6f57613d6f615780565b602002602001015160405180608001604052808a5f01516001600160a01b031681526020018a602001518152602001885f015181526020018a606001516001811115613dbd57613dbd6155ac565b9052612f65565b90935091505f836013811115613ddc57613ddc6155ac565b14613e035750604080518082018252908401518152602091820151918101919091526129e1565b600101613d29565b505f91509550959350505050565b5f613e22614ce1565b604083015181525f5b856060015151811015613e0b57613ea2888888606001518481518110613e5357613e53615780565b60200260200101518860405180608001604052808a5f01516001600160a01b031681526020018a602001518152602001885f015181526020018a606001516001811115613dbd57613dbd6155ac565b90935091505f836013811115613eba57613eba6155ac565b14613ee15750604080518082018252908401518152602091820151918101919091526129e1565b600101613e2b565b5f613ef2614ce1565b604083015181525f5b856060015151811015613f4e57613f23888888606001518481518110613e5357613e53615780565b90935091505f836013811115613f3b57613f3b6155ac565b03613f4657506129e1565b600101613efb565b50506040805180820182529201518252505f602082015260059590945092505050565b5f613f7a614ce1565b5f5b856060015151811015613ff657613fb3888888606001518481518110613fa457613fa4615780565b60200260200101518888612f65565b5092505f836013811115613fc957613fc96155ac565b03613fee5750506040805180820182529083015181525f6020820152600691506129e1565b600101613f7c565b50506040805180820182529201518252505f602082018190529590945092505050565b5f614022614ce1565b604083015181526060850151515f5b818110156140ec576140c0898989606001515f8151811061405457614054615780565b60200260200101518960400151858151811061407257614072615780565b602002602001015160405180608001604052808b5f01516001600160a01b031681526020018b602001518152602001895f015181526020018b606001516001811115613dbd57613dbd6155ac565b90945092505f8460138111156140d8576140d86155ac565b036140e45750506129e1565b600101614031565b5050604080518082018252930151835250505f6020820152600c9590945092505050565b5f614119614ce1565b604083015181525f5b846040015151811015613e0b5761414a888888606001515f81518110613d5157613d51615780565b90935091505f836013811115614162576141626155ac565b146141875750506040805180820182529083015181525f6020820152600b91506129e1565b600101614122565b5f614198614ce1565b60408084015182528401515115806141b95750846060015151846040015151115b156141c757600d91506129e1565b5f805b8560400151518110156142fb575f805b8860600151518110156142c0576001811b84165f036142b0575f8061427c8d8d8d60600151868151811061421057614210615780565b60200260200101518d60400151898151811061422e5761422e615780565b602002602001015160405180608001604052808f5f01516001600160a01b031681526020018f6020015181526020018d5f015181526020018f606001516001811115613dbd57613dbd6155ac565b90925090505f826013811115614294576142946155ac565b036142ad57955050600180821b949094179391506142c0565b50505b6142b9816158e4565b90506141da565b50806142ea5750506040805180820182529085015181525f6020820152600d935091506129e19050565b506142f4816158e4565b90506141ca565b505f9250509550959350505050565b602082015160408301515f919082601083601f81111561432c5761432c6155ac565b146143445761433f8888875f01516149d5565b61436e565b6143578888875f01518860200151614a0c565b60405161436592919061590f565b60405180910390205b9050601083601f811115614384576143846155ac565b1480156143915750818114155b156143a25760079350505050611dbf565b601183601f8111156143b6576143b66155ac565b1480156143c35750818111155b156143d45760089350505050611dbf565b601283601f8111156143e8576143e86155ac565b1480156143f55750818110155b156144065760099350505050611dbf565b5f9350505050611dbf565b6020820151604083015182515f929190839061443090899089906149d5565b9050601383601f811115614446576144466155ac565b1480156144535750818113155b156144645760089350505050611dbf565b601483601f811115614478576144786155ac565b1480156143f557508181126144065760099350505050611dbf565b60408201515f90816001855160068111156144b0576144b06155ac565b149050365f6144fc8989856144c65760206144c8565b5f5b89516144d79160ff1690615c29565b866144e35760206144e5565b5f5b60ff168a602001516144f791906158fc565b614a0c565b909250905060f084901c81811061451b57600e95505050505050611dbf565b6001600160881b0319601086901b8116608887901b82165f61453f8686818a615ab6565b61454891615add565b9050818382161461455a57600f61455c565b5f5b9e9d5050505050505050505050505050565b5f614577614ce1565b5f856040015160601c90505f86604001515f1c60a01b90505f80836001600160a01b031663b0acb980885f015189602001518e8e8c606001518e5f01518f602001518b6040518963ffffffff1660e01b81526004016145dd989796959493929190615e5d565b6040805180830381865afa1580156145f7573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061461b9190615ebc565b915091508161462b57601061462d565b5f5b604080518082018252980151885260208801919091529a95995094975050505050505050565b5f61465c614ce1565b5f61466b8888875f01516149d5565b5f1c905061467e81878660400151614a28565b92509250509550959350505050565b5f614696614ce1565b6146a98360200151858560400151614a28565b90925090505f8260138111156146c1576146c16155ac565b146146cd5760136146cf565b5f5b91509250929050565b5f6146e1614ce1565b6146f16001858560400151614a28565b90925090505f826013811115614709576147096155ac565b146146cd5760126146cf565b80515f90600181600681111561472d5761472d6155ac565b0361473b5750600192915050565b600281600681111561474f5761474f6155ac565b148061476c5750600481600681111561476a5761476a6155ac565b145b8061478857506005816006811115614786576147866155ac565b145b806147a4575060068160068111156147a2576147a26155ac565b145b156147b157505f92915050565b6020830151515f5b818110156147f0576147da85602001518281518110613b8f57613b8f615780565b6147e857505f949350505050565b6001016147b9565b506001949350505050565b5f806148078486615c29565b9050821561481657905061482f565b6148218787836149d5565b61482b9086615c29565b9150505b95945050505050565b8151600181600681111561484e5761484e6155ac565b0361485e576020828101526149cb565b6002816006811115614872576148726155ac565b0361489f5761488a6148858787876149d5565b614b5a565b614895906020615c29565b60208301526149cb565b60038160068111156148b3576148b36155ac565b036148d1576148cc868686868760200151515f88613afe565b6149cb565b60048160068111156148e5576148e56155ac565b036149295761490e86866148fa876020615c29565b866149068b8b8b6149d5565b600188613afe565b6020826020018181516149219190615c29565b9052506149cb565b600581600681111561493d5761493d6155ac565b148061495a57506006816006811115614958576149586155ac565b145b156149cb576149ac86866005846006811115614978576149786155ac565b14614983575f614986565b60045b60ff16614994886020615c29565b61499e9190615c29565b868760200151515f88613afe565b6149ba6148858787876149d5565b6149c5906020615c29565b60208301525b5091909152505050565b5f826149e2836020615c29565b1115614a0157604051631d098e2d60e21b815260040160405180910390fd5b509190910135919050565b365f858486614a1b8683615c29565b92611c4d93929190615ab6565b5f614a31614ce1565b5f80614a41858760400151613ca9565b9150915080614a5257614a5261596c565b848281518110614a6457614a64615780565b6020026020010151602001516001600160801b0316858381518110614a8b57614a8b615780565b6020026020010151604001516001600160801b031688614aab9190615c29565b1115614aef5760116040518060400160405280878152602001878581518110614ad657614ad6615780565b60200260200101515f0151815250935093505050614b52565b614af885614b88565b945086858381518110614b0d57614b0d615780565b6020026020010151604001818151614b259190615cd8565b6001600160801b031690525050604080518082019091528481525f6020820181905293509150614b529050565b935093915050565b5f60206001614b698483615c29565b614b7391906158fc565b614b7d9190615ee8565b610887906020615e46565b8051606090806001600160401b03811115614ba557614ba5614ffc565b604051908082528060200260200182016040528015614bee57816020015b604080516060810182525f80825260208083018290529282015282525f19909201910181614bc35790505b5091505f5b8181101561271257838181518110614c0d57614c0d615780565b60200260200101515f0151838281518110614c2a57614c2a615780565b60200260200101515f018181525050838181518110614c4b57614c4b615780565b602002602001015160200151838281518110614c6957614c69615780565b6020026020010151602001906001600160801b031690816001600160801b031681525050838181518110614c9f57614c9f615780565b602002602001015160400151838281518110614cbd57614cbd615780565b60209081029190910101516001600160801b03909116604090910152600101614bf3565b60408051808201909152606081525f602082015290565b60408051608081019091525f808252602082019081526020015f5b8152602001606081525090565b60408051808201909152805f614d13565b6001600160a01b03811681146117e7575f80fd5b5f8060408385031215614d56575f80fd5b823591506020830135614d6881614d31565b809150509250929050565b5f60208284031215614d83575f80fd5b81356116af81614d31565b80356001600160e01b031981168114613af9575f80fd5b5f805f60608486031215614db7575f80fd5b8335614dc281614d31565b9250614dd060208501614d8e565b91506040840135614de081614d31565b809150509250925092565b5f60208284031215614dfb575f80fd5b5035919050565b6001600160a01b0391909116815260200190565b5f8083601f840112614e26575f80fd5b5081356001600160401b03811115614e3c575f80fd5b6020830191508360208285010111156125f9575f80fd5b600281106117e7575f80fd5b80151581146117e7575f80fd5b5f805f805f805f60c0888a031215614e82575f80fd5b8735614e8d81614d31565b96506020880135955060408801356001600160401b03811115614eae575f80fd5b614eba8a828b01614e16565b9096509450506060880135614ece81614e53565b92506080880135915060a0880135614ee581614e5f565b8091505092959891949750929550565b5f5b83811015614f0f578181015183820152602001614ef7565b50505f910152565b5f8151808452614f2e816020860160208601614ef5565b601f01601f19169290920160200192915050565b8215158152604060208201525f611dbf6040830184614f17565b5f805f805f60808688031215614f70575f80fd5b8535614f7b81614d31565b94506020860135935060408601356001600160401b03811115614f9c575f80fd5b614fa888828901614e16565b9094509250506060860135614fbc81614e53565b809150509295509295909350565b5f805f60608486031215614fdc575f80fd5b833592506020840135614fee81614d31565b91506127b760408501614d8e565b634e487b7160e01b5f52604160045260245ffd5b604051608081016001600160401b038111828210171561503257615032614ffc565b60405290565b60405160a081016001600160401b038111828210171561503257615032614ffc565b604051601f8201601f191681016001600160401b038111828210171561508257615082614ffc565b604052919050565b5f6001600160401b038211156150a2576150a2614ffc565b5060051b60200190565b803560208110613af9575f80fd5b5f6001600160401b038211156150d2576150d2614ffc565b50601f01601f191660200190565b5f82601f8301126150ef575f80fd5b81356151026150fd826150ba565b61505a565b818152846020838601011115615116575f80fd5b816020850160208301375f918101602001919091529392505050565b803560048110613af9575f80fd5b5f805f805f60a08688031215615154575f80fd5b853594506151656020870135614d31565b6020860135935061517860408701614d8e565b92506001600160401b0360608701351115615191575f80fd5b6060860135860187601f8201126151a6575f80fd5b6151b36150fd823561508a565b81358082526020808301929160051b8401018a8111156151d1575f80fd5b602084015b81811015615293576001600160401b03813511156151f2575f80fd5b803585016080818e03601f19011215615209575f80fd5b615211615010565b602082013560ff811614615223575f80fd5b60208201358152600760408301351061523a575f80fd5b60408201356020820152615250606083016150ac565b60408201526001600160401b036080830135111561526c575f80fd5b61527f8e602060808501358501016150e0565b6060820152855250602093840193016151d6565b50508094505050506152a760808701615132565b90509295509295909350565b5f805f606084860312156152c5575f80fd5b8335925060208401356152d781614d31565b91506127b760408501615132565b5f80604083850312156152f6575f80fd5b823561530181614d31565b946020939093013593505050565b5f8083601f84011261531f575f80fd5b5081356001600160401b03811115615335575f80fd5b6020830191508360208260051b85010111156125f9575f80fd5b5f805f805f60608688031215615363575f80fd5b853561536e81614d31565b945060208601356001600160401b0380821115615389575f80fd5b61539589838a0161530f565b909650945060408801359150808211156153ad575f80fd5b506153ba8882890161530f565b969995985093965092949392505050565b5f602082840312156153db575f80fd5b81356001600160401b038111156153f0575f80fd5b611dbf848285016150e0565b80356001600160801b0381168114613af9575f80fd5b80356001600160401b0381168114613af9575f80fd5b5f805f805f8060c0878903121561543d575f80fd5b8635955061544d602088016153fc565b945061545b604088016153fc565b9350615469606088016153fc565b925061547760808801615412565b915061548560a08801615412565b90509295509295509295565b5f805f80608085870312156154a4575f80fd5b8435935060208501356154b681614d31565b92506154c460408601614d8e565b91506154d260608601615132565b905092959194509250565b604080825283519082018190525f906020906060840190828701845b8281101561551e5781516001600160a01b0316845292840192908401906001016154f9565b5050506001600160a01b039490941692019190915250919050565b5f805f6040848603121561554b575f80fd5b83356001600160401b03811115615560575f80fd5b61556c86828701614e16565b909790965060209590950135949350505050565b5f8060408385031215615591575f80fd5b823561559c81614d31565b91506020830135614d6881614d31565b634e487b7160e01b5f52602160045260245ffd5b600781106155d0576155d06155ac565b9052565b602081106155d0576155d06155ac565b5f6020808301818452808551808352604092508286019150828160051b8701018488015f5b8381101561567357603f198984030185528151608060ff8251168552888201516156358a8701826155c0565b5087820151615646898701826155d4565b5060609182015191850181905261565f85820183614f17565b968901969450505090860190600101615609565b509098975050505050505050565b600481106155d0576155d06155ac565b5f60a08201878352602060018060a01b03881681850152604063ffffffff60e01b881681860152606060a08187015283885180865260c08801915060c08160051b8901019550848a015f5b828110156157455760bf198a89030184528151608060ff8251168a52888201516157088a8c01826155c0565b5087820151615719898c01826155d4565b5086820151915080878b0152615731818b0183614f17565b9950505092860192908601906001016156dc565b5050505050505080915050611a6d6080830184615681565b8381526001600160a01b038316602082015260608101611dbf6040830184615681565b634e487b7160e01b5f52603260045260245ffd5b5f602082840312156157a4575f80fd5b81356116af81614e5f565b634e487b7160e01b5f52601160045260245ffd5b5f61ffff8083168181036157d9576157d96157af565b6001019392505050565b6001600160a01b0386168152606060208083018290529082018590525f906001600160fb1b03861115615814575f80fd5b8560051b80886080860137830183810360809081016040860152810185905285905f9060a0015b8682101561586457823561584e81614e5f565b151581529183019160019190910190830161583b565b9a9950505050505050505050565b5f805f60608486031215615884575f80fd5b835161588f81614d31565b60208501519093506158a081614d31565b6040850151909250614de081614d31565b8481526001600160a01b03841660208201526001600160e01b0319831660408201526080810161482f6060830184615681565b5f600182016158f5576158f56157af565b5060010190565b81810381811115610887576108876157af565b818382375f9101908152919050565b6001600160e01b031981358181169160048510156159465780818660040360031b1b83161692505b505092915050565b6040810160148410615962576159626155ac565b9281526020015290565b634e487b7160e01b5f52600160045260245ffd5b6001600160801b03828116828216039080821115612f5e57612f5e6157af565b600281106155d0576155d06155ac565b60018060a01b0385168152836020820152608060408201525f6159d66080830185614f17565b905061482f60608301846159a0565b5f82601f8301126159f4575f80fd5b8151615a026150fd826150ba565b818152846020838601011115615a16575f80fd5b611dbf826020830160208701614ef5565b5f8060408385031215615a38575f80fd5b8251615a4381614e5f565b60208401519092506001600160401b03811115615a5e575f80fd5b6125f5858286016159e5565b5f60208284031215615a7a575f80fd5b81516116af81614e5f565b5f60208284031215615a95575f80fd5b81516001600160401b03811115615aaa575f80fd5b611dbf848285016159e5565b5f8085851115615ac4575f80fd5b83861115615ad0575f80fd5b5050820193919092039150565b80356020831015610887575f19602084900360031b1b1692915050565b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b60018060a01b0386168152846020820152608060408201525f615b49608083018587615afa565b9050611a6d60608301846159a0565b5f6020808385031215615b69575f80fd5b82516001600160401b03811115615b7e575f80fd5b8301601f81018513615b8e575f80fd5b8051615b9c6150fd8261508a565b81815260a09182028301840191848201919088841115615bba575f80fd5b938501935b838510156113fc5780858a031215615bd6575f8081fd5b615bde615038565b8551615be981614e53565b815285870151615bf881614d31565b8188015260408681015190820152606080870151908201526080808701519082015283529384019391850191615bbf565b80820180821115610887576108876157af565b6001600160401b03818116838216019080821115612f5e57612f5e6157af565b6001600160401b03828116828216039080821115612f5e57612f5e6157af565b634e487b7160e01b5f52601260045260245ffd5b5f6001600160401b0380841680615ca957615ca9615c7c565b92169190910492915050565b6001600160801b03818116838216028082169190828114615946576159466157af565b6001600160801b03818116838216019080821115612f5e57612f5e6157af565b6001600160401b03818116838216028082169190828114615946576159466157af565b604081525f615d2d6040830185614f17565b90508260208301529392505050565b5f60208284031215615d4c575f80fd5b81516116af81614d31565b6001600160f81b031981358181169160018510156159465760019490940360031b84901b1690921692915050565b838152604060208201525f611dbc604083018486615afa565b5f8251615daf818460208701614ef5565b9190910192915050565b805160208201516001600160e01b03198082169291906004831015615de85780818460040360031b1b83161693505b505050919050565b606360f81b815260e083901b6001600160e01b03191660018201526880600e6000396000f360b81b60058201525f600e82018190528251615e3881600f850160208701614ef5565b91909101600f019392505050565b8082028115828204841417610887576108876157af565b60018060a01b038916815287602082015260e060408201525f615e8460e08301888a615afa565b9050615e9360608301876159a0565b608082019490945260a08101929092526001600160a01b03191660c09091015295945050505050565b5f8060408385031215615ecd575f80fd5b8251615ed881614e5f565b6020939093015192949293505050565b5f82615ef657615ef6615c7c565b50049056fea15bc60c955c405d20d9149c709e2460f1c2d9a497496a7f46004d1772c3054ca2646970667358221220effee86583e9a9dfea71c1020808e6a7f1ab205668c8679fce5a2d2485ca407b64736f6c63430008150033000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001
Deployed Bytecode
0x608060405234801561000f575f80fd5b50600436106101ab575f3560e01c80637508dd98116100eb578063b3dd25c71161008f578063b3dd25c71461044a578063c6fe87471461045d578063cc2f845214610470578063d4b8399214610491578063d8afba76146104a4578063e009cfde146104b7578063e29dfba8146104ca578063f2fde38b146104f7575f80fd5b80637508dd98146103bd578063776d1a01146103d05780637b0da5b2146103e35780638da5cb5b146103f6578063946d364e146103fe578063957ed2b314610411578063a4f9edbf14610424578063a8ec43ee14610437575f80fd5b8063468721a711610152578063468721a7146102ac5780635229073f146102bf5780635aef7de6146102d25780635e7c9fe8146102e4578063610b59251461037c57806366523f7d1461038f57806369ecc3cf146103a2578063715018a6146103b5575f80fd5b80630172a43a146101af578063086cfca8146101c45780630c6c76b8146101d75780632916a9af146101ea5780632959513c146101fd5780632b99e5061461023b5780632d3c25471461025c5780632d9ad53d14610289575b5f80fd5b6101c26101bd366004614d45565b61050a565b005b6101c26101d2366004614d73565b6105e0565b6101c26101e5366004614d45565b610637565b6101c26101f8366004614da5565b61070b565b61022561020b366004614deb565b60066020525f90815260409020546001600160a01b031681565b6040516102329190614e02565b60405180910390f35b61024e610249366004614e6c565b6107b0565b604051610232929190614f42565b61027b61026a366004614d73565b60076020525f908152604090205481565b604051908152602001610232565b61029c610297366004614d73565b610854565b6040519015158152602001610232565b61029c6102ba366004614f5c565b61088d565b61024e6102cd366004614f5c565b61090f565b5f54610225906001600160a01b031681565b61033d6102f2366004614deb565b60056020525f9081526040902080546001909101546001600160801b0380831692600160801b90048116916001600160401b0380821692600160401b83041691600160c01b90041685565b604080516001600160801b03968716815294861660208601526001600160401b039384169085015293166060830152909116608082015260a001610232565b6101c261038a366004614d73565b610998565b6101c261039d366004614fca565b610aa7565b6101c26103b0366004614deb565b610b31565b6101c2610b83565b6101c26103cb366004615140565b610b96565b6101c26103de366004614d73565b610c69565b6101c26103f13660046152b3565b610cc2565b610225610d9d565b6101c261040c3660046152e5565b610dcb565b6101c261041f36600461534f565b610e23565b6101c26104323660046153cb565b610f38565b6101c2610445366004615428565b6110f1565b6101c2610458366004615491565b6112ea565b61029c61046b366004614e6c565b61136a565b61048361047e3660046152e5565b611408565b6040516102329291906154dd565b600154610225906001600160a01b031681565b61027b6104b2366004615539565b611598565b6101c26104c5366004615580565b6116b6565b61029c6104d83660046152e5565b600260209081525f928352604080842090915290825290205460ff1681565b6101c2610505366004614d73565b6117ad565b6105126117ea565b6040805180820182525f8082526020808301829052858252600481528382206001600160a01b0386168352600190810190915292902081518154929391929091839160ff19169083600281111561056b5761056b6155ac565b021790555060208201518154829061ff001916610100836003811115610593576105936155ac565b021790555050604080518481526001600160a01b03841660208201527f3ccf62aacc3286173cedf5c20ec550071636a2faf0a3b28d93841736a43f822b9250015b60405180910390a15050565b6105e86117ea565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f52ae88b092de36f87fb43fe794eb1381023b9c1bce563a871154022c63dce3429190a35050565b61063f6117ea565b6040805180820190915280600281526020015f90525f8381526004602090815260408083206001600160a01b038616845260019081019092529091208251815491929091839160ff199091169083600281111561069e5761069e6155ac565b021790555060208201518154829061ff0019166101008360038111156106c6576106c66155ac565b021790555050604080518481526001600160a01b03841660208201527f277465b84f512b759d745fab70327b693ee21ce592fca91a3f491739a25fa76a9250016105d4565b6107136117ea565b60a082901c63ffffffff60401b16606084811b6001600160601b031916919091175f9081526006602090815260409182902080546001600160a01b0319166001600160a01b03868116918217909255835191881682526001600160e01b0319871692820192909252918201527f1330d96b64c7e86736f77e027ca34223dd3d1d08049281281c9d597d8098ed5991015b60405180910390a1505050565b5f60605f6107c2858b8b8b8b8b61181c565b90506107cd81611a77565b61080f8a8a8a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152508c9250611bd0915050565b909350915083801561081f575082155b1561083d5760405163d27b44a960e01b815260040160405180910390fd5b6108478184611c5a565b5097509795505050505050565b5f60016001600160a01b0383161480159061088757506001600160a01b038281165f908152600360205260409020541615155b92915050565b335f9081526007602052604081205481906108ac90888888888861181c565b90506108b781611a77565b6108f9878787878080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250899250611d46915050565b91506109058183611c5a565b5095945050505050565b335f90815260076020526040812054606090829061093190898989898961181c565b905061093c81611a77565b61097e888888888080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152508a9250611bd0915050565b909350915061098d8184611c5a565b509550959350505050565b6109a06117ea565b6001600160a01b03811615806109bf57506001600160a01b0381166001145b156109e85780604051635c93ff2f60e11b81526004016109df9190614e02565b60405180910390fd5b6001600160a01b038181165f908152600360205260409020541615610a225780604051632061897360e01b81526004016109df9190614e02565b60036020525f80516020615efc83398151915280546001600160a01b038381165f81815260408082208054949095166001600160a01b03199485161790945560019052835490911617909155517fecdf3a3effea5783a3c4c2140e677577666428d44ed9d474a0b3a4c9943f844090610a9c908390614e02565b60405180910390a150565b610aaf6117ea565b5f83815260046020526040812060020190610aca8484611dc7565b81526020019081526020015f205f90557f32a3a599b308fc900a0e6513db2ad40bf0c94367da90048a4b308d8c6b2dd6ea8383836040516107a3939291909283526001600160a01b039190911660208301526001600160e01b031916604082015260600190565b335f908152600260209081526040808320848452825291829020805460ff1916600117905590518281527f89a77869d7b8125ba16e08a92ddc8cc26fb1fa47241971167954489a5e66c2559101610a9c565b610b8b6117ea565b610b945f611de7565b565b610b9e6117ea565b60405163783a904760e01b8152736a6af4b16458bc39817e4019fb02bd3b26d410499063783a904790610bd59085906004016155e4565b5f6040518083038186803b158015610beb575f80fd5b505af4158015610bfd573d5f803e3d5ffd5b5050505f868152600460205260409020610c239150610c1c8686611dc7565b8484611e57565b7f4f6c340456f64db31a3d003c1224ba1de058557b1cdf71f21ae48ce4a4f64f528585858585604051610c5a959493929190615691565b60405180910390a15050505050565b610c716117ea565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f90cc2f570a6eb594b1580ea3e41247d2d73a55281889e86bd4ec2fc29c7e62d6905f90a35050565b610cca6117ea565b604080518082019091528060018152602001826003811115610cee57610cee6155ac565b90525f8481526004602090815260408083206001600160a01b038716845260019081019092529091208251815491929091839160ff1990911690836002811115610d3a57610d3a6155ac565b021790555060208201518154829061ff001916610100836003811115610d6257610d626155ac565b02179055509050507f05e4ec9b54e94ad676ef61d57214f6d57d752ed2022dea5e5f956d5df7ccb2508383836040516107a39392919061575d565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031690565b610dd36117ea565b6001600160a01b0382165f81815260076020908152604091829020849055815192835282018390527f60c85b61661a191efceebca036d48b290e04a1f08dd96472b920adbdd50c64e891016105d4565b610e2b6117ea565b828114610e4b576040516374f4d53760e01b815260040160405180910390fd5b5f5b61ffff8116841115610eea5782828261ffff16818110610e6f57610e6f615780565b9050602002016020810190610e849190615794565b60045f87878561ffff16818110610e9d57610e9d615780565b602090810292909201358352508181019290925260409081015f9081206001600160a01b038b1682529092529020805460ff1916911515919091179055610ee3816157c3565b9050610e4d565b50610ef485610854565b610f0157610f0185610998565b7f9f8368fa4ddcbd561efd7ad2a2174235bf5b840a73fb18f20db9705c114624988585858585604051610c5a9594939291906157e3565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b03165f81158015610f7c5750825b90505f826001600160401b03166001148015610f975750303b155b905081158015610fa5575080155b15610fc35760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315610fed57845460ff60401b1916600160401b1785555b5f805f888060200190518101906110049190615872565b92509250925061101383611de7565b5f80546001600160a01b038085166001600160a01b031992831617909255600180549284169290911691909117905561104a611f06565b816001600160a01b0316836001600160a01b0316336001600160a01b03167f34d3b96a088381c6843a1f9d94d251afa88f83cc7a0d17fc23a7057506a3fc6d846040516110979190614e02565b60405180910390a450505083156110e957845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2906020015b60405180910390a15b505050505050565b6110f96117ea565b836001600160801b03165f03611116576001600160801b03611118565b835b9350806001600160401b03165f036111305742611132565b805b90506040518060a00160405280846001600160801b03168152602001856001600160801b03168152602001836001600160401b03168152602001866001600160801b03168152602001826001600160401b031681525060055f8881526020019081526020015f205f820151815f015f6101000a8154816001600160801b0302191690836001600160801b031602179055506020820151815f0160106101000a8154816001600160801b0302191690836001600160801b031602179055506040820151816001015f6101000a8154816001600160401b0302191690836001600160401b0316021790555060608201518160010160086101000a8154816001600160801b0302191690836001600160801b0316021790555060808201518160010160186101000a8154816001600160401b0302191690836001600160401b031602179055509050507f63d7ec44a20b176da1d60d75259d264ee67b3d8213706afa71a28f69ed8ebece8686868686866040516110e0969594939291909586526001600160801b0394851660208701529284166040860152921660608401526001600160401b0391821660808401521660a082015260c00190565b6112f26117ea565b6112fb81611f71565b5f858152600460205260408120600201906113168686611dc7565b81526020019081526020015f20819055507f9603b65b11492fec54ccc3d9feb93536f804d82e12228187ff730a253fc283ee8484848460405161135c94939291906158b1565b60405180910390a150505050565b5f8061137a848a8a8a8a8a61181c565b905061138581611a77565b6113c7898989898080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152508b9250611d46915050565b91508280156113d4575081155b156113f25760405163d27b44a960e01b815260040160405180910390fd5b6113fc8183611c5a565b50979650505050505050565b60605f6001600160a01b03841660011480159061142b575061142984610854565b155b1561144b5783604051635c93ff2f60e11b81526004016109df9190614e02565b825f0361146b576040516372dbed9760e11b815260040160405180910390fd5b826001600160401b0381111561148357611483614ffc565b6040519080825280602002602001820160405280156114ac578160200160208202803683370190505b506001600160a01b038086165f90815260036020526040812054929450911691505b6001600160a01b038216158015906114f057506001600160a01b038216600114155b80156114fb57508381105b15611555578183828151811061151357611513615780565b6001600160a01b039283166020918202929092018101919091529281165f9081526003909352604090922054909116908061154d816158e4565b9150506114ce565b6001600160a01b03821660011461158d57826115726001836158fc565b8151811061158257611582615780565b602002602001015191505b808352509250929050565b604080517f47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a79469218602082015246918101919091523060608201525f9081906080016040516020818303038152906040528051906020012090505f601960f81b600160f81b837f2939aeeda3ca260200c9f7b436b19e13207547ccc65cfedc857751c5ea6d91d45f1b898960405161162e92919061590f565b6040805191829003822060208301939093528101919091526060810188905260800160408051808303601f190181529082905280516020918201206001600160f81b0319958616918301919091529290931660218401526022830152604282015260620160408051601f198184030181529190528051602090910120925050505b9392505050565b6116be6117ea565b6001600160a01b03811615806116dd57506001600160a01b0381166001145b156116fd5780604051635c93ff2f60e11b81526004016109df9190614e02565b6001600160a01b038281165f9081526003602052604090205481169082161461173b5780604051638b4189ff60e01b81526004016109df9190614e02565b6001600160a01b038181165f81815260036020526040808220805487861684528284208054919096166001600160a01b0319918216179095559290915281549092169055517faab4fa2b463f581b2b32cb3b7e3b704b9ce37cc209b5fb4d77e593ace4054276906105d4908390614e02565b6117b56117ea565b6001600160a01b0381166117de575f604051631e4fbdf760e01b81526004016109df9190614e02565b6117e781611de7565b50565b336117f3610d9d565b6001600160a01b031614610b94573360405163118cdaa760e01b81526004016109df9190614e02565b335f908152600360205260409020546060906001600160a01b031661192c575f80611845611f94565b6001600160a01b038082165f90815260036020526040902054929450909250166118845733604051634a0bfec160e01b81526004016109df9190614e02565b6001600160a01b0381165f90815260026020908152604080832085845290915290205460ff16156118cb57604051639e1dc0c560e01b8152600481018390526024016109df565b6001600160a01b0381165f908152600260209081526040808320858452825291829020805460ff1916600117905590518381527f8c8e19e7e8e193118a05465d7676e82215052d3cb150628fbf598105dc2bb6ab910160405180910390a150505b5f87900361194d57604051631fb1d3e560e31b815260040160405180910390fd5b5f8781526004602052604081209081906119656120ef565b6001600160a01b0316815260208101919091526040015f205460ff1661199e57604051631fb1d3e560e31b815260040160405180910390fd5b5f6119e4886119ad878961591e565b60a01c63ffffffff60401b1660609190911b6001600160601b031916175f908152600660205260409020546001600160a01b031690565b90505f6119ef614ce1565b6001600160a01b038316611a1957611a0f848b8b8b8b8b875f015161214a565b9092509050611a2e565b611a2883858c8c8c8c8c612398565b90925090505b5f826013811115611a4157611a416155ac565b14611a66576020810151604051631a1537eb60e31b81526109df91849160040161594e565b5193505050505b9695505050505050565b80515f5b81811015611bcb575f838281518110611a9657611a96615780565b60209081029190910181015180516040808301515f83815260058652828120835160a08101855281546001600160801b038082168352600160801b90910481169882019890985260018201546001600160401b0380821696830196909652600160401b81049098166060820152600160c01b90970490931660808701529395509193919290918190611b2890426124dd565b9150915085602001516001600160801b0316826001600160801b031614611b5157611b5161596c565b816001600160801b0316846001600160801b03161115611b7357611b7361596c565b611b7d8483615980565b600193840180546001600160401b03938416600160c01b026001600160c01b036001600160801b0394909416600160401b029390931693169290921717905550939093019250611a7b915050565b505050565b600154604051635229073f60e01b81525f916060916001600160a01b0390911690635229073f90611c0b9089908990899089906004016159b0565b5f604051808303815f875af1158015611c26573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611c4d9190810190615a27565b9150915094509492505050565b81515f5b81811015611d40575f848281518110611c7957611c79615780565b602002602001015190505f815f015190508415611cf657604082015160208301517f90355d540c2980efb4c360996dfc5405ee87e812e4f3db843857547cbdb5af65918391611cc9908290615980565b604080519384526001600160801b03928316602085015291169082015260600160405180910390a1611d36565b6020808301515f8381526005909252604090912060010180546001600160801b03909216600160401b02600160401b600160c01b03199092169190911790555b5050600101611c5e565b50505050565b60015460405163468721a760e01b81525f916001600160a01b03169063468721a790611d7c9088908890889088906004016159b0565b6020604051808303815f875af1158015611d98573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611dbc9190615a6a565b90505b949350505050565b60a01c63ffffffff60401b1660609190911b6001600160601b0319161790565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a3505050565b604051634031b16960e11b81525f907361c5b1be435391fdd7bc6703f3740c0d11728a8c9063806362d290611e909086906004016155e4565b5f60405180830381865af4158015611eaa573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611ed19190810190615a85565b90505f611edd82612600565b9050611eeb84518483612719565b5f958652600290960160205250506040909220929092555050565b60015f5260036020525f80516020615efc833981519152546001600160a01b031615611f455760405163dfd49ebd60e01b815260040160405180910390fd5b60015f81905260036020525f80516020615efc83398151915280546001600160a01b0319169091179055565b5f600160d81b60e0836003811115611f8b57611f8b6155ac565b901b1792915050565b5f8080366065811015611fac57505f93849350915050565b5f805f611fb9858561274a565b919450925090505f611fcc6061866158fc565b90505f611fdb8683818a615ab6565b611fe491615add565b90508460ff165f0361206a57826004811080611fff57508281115b1561201557505f998a9950975050505050505050565b845f61202c61202684838c8e615ab6565b86611598565b905061204a82828c8c87908a9261204593929190615ab6565b6127c0565b612055575f80612058565b80825b9b509b50505050505050505050509091565b5f61208061207a84838a8c615ab6565b84611598565b604080515f81526020810180835283905260ff8916918101919091526060810187905260808101869052909150819060019060a0016020604051602081039080840390855afa1580156120d5573d5f803e3d5ffd5b505050602060405103519950995050505050505050509091565b335f908152600360205260408120546001600160a01b03161561211157503390565b5f61211a611f94565b6001600160a01b038082165f908152600360205260409020549193501615905061214357919050565b5f91505090565b5f612153614ce1565b84158015906121625750600485105b1561218057604051632342609160e11b815260040160405180910390fd5b60026001600160a01b0389165f90815260018b01602052604090205460ff1660028111156121b0576121b06155ac565b036122f2575f6121c9896121c4888a61591e565b611dc7565b5f81815260028c01602052604081205491925081900361221b57600360405180604001604052808781526020018a8a90612203919061591e565b6001600160e01b03191681525093509350505061238c565b5f80612226836128a2565b915091505f6122368c8a846128cc565b90505f81601381111561224b5761224b6155ac565b1461227257604080518082019091528881525f6020820152909650945061238c9350505050565b821561229e575f60405180604001604052808a81526020015f801b81525096509650505050505061238c565b505050506122e88a82898960405180608001604052808f6001600160a01b031681526020018e81526020018a81526020018b60018111156122e1576122e16155ac565b9052612980565b925092505061238c565b60016001600160a01b0389165f90815260018b01602052604090205460ff166002811115612322576123226155ac565b03612373576001600160a01b0388165f90815260018a0160205260409020546123569088908690610100900460ff166128cc565b604080518082019091528481525f6020820152909250905061238c565b5050604080518082019091528181525f60208201526002905b97509795505050505050565b5f6123a1614ce1565b60405163c7a7b63560e01b81526001600160a01b038a169063c7a7b635906123d5908a908a908a908a908a90600401615b22565b5f60405180830381865afa92505050801561241157506040513d5f823e601f3d908101601f1916820160405261240e9190810190615b58565b60015b61242e576040516315e649e960e01b815260040160405180910390fd5b5f5b81518110156124cf575f82828151811061244c5761244c615780565b602002602001015190505f816060015190505f82608001518261246f9190615c29565b905061249a8d846020015185604001518d8d8790879261249193929190615ab6565b88518c5161214a565b90975095505f8760138111156124b2576124b26155ac565b146124c157505050505061238c565b836001019350505050612430565b505097509795505050505050565b5f8083604001516001600160401b03165f148061251e5750836040015184608001516125099190615c3c565b6001600160401b0316836001600160401b0316105b15612534575050606082015160808301516125f9565b5f846040015185608001518561254a9190615c5c565b6125549190615c90565b905084602001516001600160801b031685606001516001600160801b031610156125cf57845161258e906001600160401b03831690615cb5565b856060015161259d9190615cd8565b925084602001516001600160801b0316836001600160801b0316106125c65784602001516125c8565b825b92506125d7565b846060015192505b60408501516125e69082615cf8565b85608001516125f59190615c3c565b9150505b9250929050565b5f8061260b836129eb565b905061266d818051602091820120604080516001600160f81b03198185015273ce0042b868300000d44a59004da54a005ffdcf9f60601b60218201525f6035820152605580820193909352815180820390930183526075019052805191012090565b9150813b5f8190036127125760405163257b1f8160e11b815273ce0042b868300000d44a59004da54a005ffdcf9f90634af63f02906126b29085905f90600401615d1b565b6020604051808303815f875af11580156126ce573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906126f29190615d3c565b6001600160a01b0316836001600160a01b0316146127125761271261596c565b5050919050565b5f6001600160a01b03821660e0846003811115612738576127386155ac565b60f087901b911b171790509392505050565b5f8080848461275a6001826158fc565b612765928290615ab6565b61276e91615d57565b60f81c925084846127806041826158fc565b61278b928290615ab6565b61279491615add565b915084846127a36021826158fc565b6127ae928290615ab6565b6127b791615add565b90509250925092565b5f843b8082036127d3575f915050611dbf565b5f866001600160a01b0316631626ba7e60e01b8787876040516024016127fb93929190615d85565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516128399190615d9e565b5f60405180830381855afa9150503d805f8114612871576040519150601f19603f3d011682016040523d82523d5f602084013e612876565b606091505b509150630b135d3f60e11b905061288c82615db9565b6001600160e01b03191614979650505050505050565b600160d81b811615155f60e083901c60ff1660038111156128c5576128c56155ac565b9050915091565b5f80841180156128ee575060018260038111156128eb576128eb6155ac565b14155b801561290c57506003826003811115612909576129096155ac565b14155b15612919575060046116af565b600183600181111561292d5761292d6155ac565b14801561294c57506002826003811115612949576129496155ac565b14155b801561296a57506003826003811115612967576129676155ac565b14155b15612977575060016116af565b505f9392505050565b5f612989614ce1565b5f806129958989612a23565b915091505f6129a5888885612bea565b90505f866040015151116129b957816129c7565b6129c7866040015183612c3f565b60408701526129d9888885848a612f65565b945094505050505b9550959350505050565b6060815160016129fb9190615c29565b82604051602001612a0d929190615df0565b6040516020818303038152906040529050919050565b612a4c6040805160808101909152805f81526020015f81525f6020820152606060409091015290565b5f82815260028401602052604081205460609160f082901c916001600160a01b031690612a788261320b565b90505f80612a868386613283565b915091505f805b8351811015612baa575f848281518110612aa957612aa9615780565b6020026020010151604001519050601c601f811115612aca57612aca6155ac565b81601f811115612adc57612adc6155ac565b10612af157612aea836158e4565b9250612ba1565b600f81601f811115612b0557612b056155ac565b03612ba1576010858381518110612b1e57612b1e615780565b602002602001015160400190601f811115612b3b57612b3b6155ac565b9081601f811115612b4e57612b4e6155ac565b9052505f54604051612b6c916001600160a01b031690602001614e02565b60405160208183030381529060405280519060200120848381518110612b9457612b94615780565b6020026020010181815250505b50600101612a8d565b50612bc08383612bb986613473565b5f8c6135b6565b875f8211612bce5787612bd9565b612bd984848461378c565b975097505050505050509250929050565b612c0c60405180606001604052805f81526020015f8152602001606081525090565b5f612c1683613972565b9050612c2d85856004848560200151515f88613afe565b505f8152602081019290925250919050565b606082515f03612c50575080610887565b81515f03612c5f575081610887565b81518351612c6d9190615c29565b6001600160401b03811115612c8457612c84614ffc565b604051908082528060200260200182016040528015612ccd57816020015b604080516060810182525f80825260208083018290529282015282525f19909201910181612ca25790505b5083519091505f5b81811015612dc357848181518110612cef57612cef615780565b60200260200101515f0151838281518110612d0c57612d0c615780565b60200260200101515f018181525050848181518110612d2d57612d2d615780565b602002602001015160200151838281518110612d4b57612d4b615780565b6020026020010151602001906001600160801b031690816001600160801b031681525050848181518110612d8157612d81615780565b602002602001015160400151838281518110612d9f57612d9f615780565b60209081029190910101516001600160801b03909116604090910152600101612cd5565b505f5b8351811015612f50575f80612df787878581518110612de757612de7615780565b60200260200101515f0151613ca9565b915091508015612e5a57858381518110612e1357612e13615780565b602002602001015160400151858381518110612e3157612e31615780565b6020026020010151604001818151612e499190615cd8565b6001600160801b0316905250612f46565b858381518110612e6c57612e6c615780565b60200260200101515f0151858581518110612e8957612e89615780565b60200260200101515f018181525050858381518110612eaa57612eaa615780565b602002602001015160200151858581518110612ec857612ec8615780565b6020026020010151602001906001600160801b031690816001600160801b031681525050858381518110612efe57612efe615780565b602002602001015160400151858581518110612f1c57612f1c615780565b60209081029190910101516001600160801b0390911660409091015283612f42816158e4565b9450505b5050600101612dc6565b508151811015612f5e578082525b5092915050565b5f612f6e614ce1565b6020850151601081601f811115612f8757612f876155ac565b10156130e1575f81601f811115612fa057612fa06155ac565b03612fc55750506040805180820182529083015181525f6020820181905291506129e1565b600581601f811115612fd957612fd96155ac565b03612ff557612feb8888888888613cfe565b92509250506129e1565b600181601f811115613009576130096155ac565b0361301b57612feb8888888888613e19565b600281601f81111561302f5761302f6155ac565b0361304157612feb8888888888613ee9565b600381601f811115613055576130556155ac565b0361306757612feb8888888888613f71565b600681601f81111561307b5761307b6155ac565b0361308d57612feb8888888888614019565b600781601f8111156130a1576130a16155ac565b036130b357612feb8888888888614110565b600881601f8111156130c7576130c76155ac565b146130d4576130d461596c565b612feb888888888861418f565b601281601f8111156130f5576130f56155ac565b11613127576131068888888861430a565b6040805180820182529086015181525f602082015290935091506129e19050565b601481601f81111561313b5761313b6155ac565b1161314c5761310688888888614411565b601581601f811115613160576131606155ac565b036131715761310688888888614493565b601681601f811115613185576131856155ac565b0361319757612feb888888888861456e565b601c81601f8111156131ab576131ab6155ac565b036131bd57612feb8888888888614653565b601d81601f8111156131d1576131d16155ac565b036131e057612feb868561468d565b601e81601f8111156131f4576131f46155ac565b146132015761320161596c565b612feb86856146d8565b6060813b6001811161321f5761321f61596c565b60015f61322c82846158fc565b9050806001600160401b0381111561324657613246614ffc565b6040519080825280601f01601f191660200182016040528015613270576020820181803683370190505b509350808260208601873c505050919050565b606080826001600160401b0381111561329e5761329e614ffc565b6040519080825280602002602001820160405280156132d757816020015b6132c4614cf8565b8152602001906001900390816132bc5790505b509150826001600160401b038111156132f2576132f2614ffc565b60405190808252806020026020018201604052801561331b578160200160208202803683370190505b5090505f60208161332d600287615e46565b613338906020615c29565b90505f5b8681101561346857878301519350613355600284615c29565b92505f8460f01c90505f87838151811061337157613371615780565b6020908102919091010151600883901c60ff1681529050600582901c60071660068111156133a1576133a16155ac565b816020019060068111156133b7576133b76155ac565b908160068111156133ca576133ca6155ac565b905250601f828116908111156133e2576133e26155ac565b8160400190601f8111156133f8576133f86155ac565b9081601f81111561340b5761340b6155ac565b90525060108160400151601f811115613426576134266155ac565b1061345e5789840151955061343c602085615c29565b93508587848151811061345157613451615780565b6020026020010181815250505b505060010161333c565b505050509250929050565b8051606090806134855761348561596c565b806001600160401b0381111561349d5761349d614ffc565b6040519080825280602002602001820160405280156134ef57816020015b6134dc60405180606001604052805f81526020015f81526020015f81525090565b8152602001906001900390816134bb5790505b5091505f19825f8151811061350657613506615780565b60209081029190910101515260015b81811015612712575f1983828151811061353157613531615780565b60200260200101515f0181815250505f8385838151811061355457613554615780565b60200260200101515f015160ff168151811061357257613572615780565b602002602001015190505f19815f01510361358b578181525b613596826001615c29565b6020820181905281516135a8916158fc565b604090910152600101613515565b5f8583815181106135c9576135c9615780565b602002602001015190508060200151825f019060068111156135ed576135ed6155ac565b90816006811115613600576136006155ac565b90525060408101516020830190601f81111561361e5761361e6155ac565b9081601f811115613631576136316155ac565b8152505084838151811061364757613647615780565b602002602001015182604001818152505083838151811061366a5761366a615780565b6020026020010151604001515f036136825750613785565b5f84848151811061369557613695615780565b60200260200101515f015190505f8585815181106136b5576136b5615780565b6020026020010151604001519050806001600160401b038111156136db576136db614ffc565b60405190808252806020026020018201604052801561373557816020015b6137226040805160808101909152805f81526020015f81525f6020820152606060409091015290565b8152602001906001900390816136f95790505b5060608501525f5b81811015613780576137788989896137558588615c29565b8960600151868151811061376b5761376b615780565b60200260200101516135b6565b60010161373d565b505050505b5050505050565b8251606090826001600160401b038111156137a9576137a9614ffc565b6040519080825280602002602001820160405280156137f257816020015b604080516060810182525f80825260208083018290529282015282525f199092019101816137c75790505b5091505f805b8281101561395c57601c87828151811061381457613814615780565b602002602001015160400151601f811115613831576138316155ac565b1061394c575f86828151811061384957613849615780565b602002602001015190505f61385e8683613ca9565b915050801561386e57505061394c565b8186858151811061388157613881615780565b602090810291909101810151919091525f83815260058252604090819020815160a08101835281546001600160801b038082168352600160801b9091048116948201949094526001909101546001600160401b0380821693830193909352600160401b81049093166060820152600160c01b90920416608082015261390690426124dd565b5086858151811061391957613919615780565b6020026020010151602001816001600160801b03166001600160801b0316815250508380613946906158e4565b94505050505b613955816158e4565b90506137f8565b5083811015613969578083525b50509392505050565b61397a614d20565b60018260200151601f811115613992576139926155ac565b101580156139b6575060038260200151601f8111156139b3576139b36155ac565b11155b156139f5575f826060015151116139cf576139cf61596c565b61088782606001515f815181106139e8576139e8615780565b6020026020010151613972565b815181906006811115613a0a57613a0a6155ac565b90816006811115613a1d57613a1d6155ac565b90525060608201515115613af9575f600483516006811115613a4157613a416155ac565b14613a5157826060015151613a54565b60015b9050806001600160401b03811115613a6e57613a6e614ffc565b604051908082528060200260200182016040528015613aa757816020015b613a94614d20565b815260200190600190039081613a8c5790505b5060208301525f5b8181101561271257613ad0846060015182815181106139e8576139e8615780565b83602001518281518110613ae657613ae6615780565b6020908102919091010152600101613aaf565b919050565b826001600160401b03811115613b1657613b16614ffc565b604051908082528060200260200182016040528015613b6957816020015b613b5660405180606001604052805f81526020015f8152602001606081525090565b815260200190600190039081613b345790505b5060408201525f8215613b9f57613b9c85602001515f81518110613b8f57613b8f615780565b6020026020010151614715565b90505b5f805b85811015613c9d5784613bcb57613bc887602001518281518110613b8f57613b8f615780565b92505b613c2a8a8a613bdd8d8d8d888a6147fb565b8a6020015189613bed5785613bef565b5f5b81518110613bff57613bff615780565b602002602001015188604001518681518110613c1d57613c1d615780565b6020026020010151614838565b5f84604001518281518110613c4157613c41615780565b602002602001015160200151905083613c6457613c5f816020615c29565b613c66565b805b85602001818151613c779190615c29565b90525083613c86576020613c88565b805b613c929084615c29565b925050600101613ba2565b50505050505050505050565b81515f908190815b81811015613cf15784868281518110613ccc57613ccc615780565b60200260200101515f015103613ce9579250600191506125f99050565b600101613cb1565b505f958695509350505050565b5f613d07614ce1565b60408084015182528401515160608601515114613d2757600a91506129e1565b5f5b856060015151811015613e0b57613dc4888888606001518481518110613d5157613d51615780565b602002602001015188604001518581518110613d6f57613d6f615780565b602002602001015160405180608001604052808a5f01516001600160a01b031681526020018a602001518152602001885f015181526020018a606001516001811115613dbd57613dbd6155ac565b9052612f65565b90935091505f836013811115613ddc57613ddc6155ac565b14613e035750604080518082018252908401518152602091820151918101919091526129e1565b600101613d29565b505f91509550959350505050565b5f613e22614ce1565b604083015181525f5b856060015151811015613e0b57613ea2888888606001518481518110613e5357613e53615780565b60200260200101518860405180608001604052808a5f01516001600160a01b031681526020018a602001518152602001885f015181526020018a606001516001811115613dbd57613dbd6155ac565b90935091505f836013811115613eba57613eba6155ac565b14613ee15750604080518082018252908401518152602091820151918101919091526129e1565b600101613e2b565b5f613ef2614ce1565b604083015181525f5b856060015151811015613f4e57613f23888888606001518481518110613e5357613e53615780565b90935091505f836013811115613f3b57613f3b6155ac565b03613f4657506129e1565b600101613efb565b50506040805180820182529201518252505f602082015260059590945092505050565b5f613f7a614ce1565b5f5b856060015151811015613ff657613fb3888888606001518481518110613fa457613fa4615780565b60200260200101518888612f65565b5092505f836013811115613fc957613fc96155ac565b03613fee5750506040805180820182529083015181525f6020820152600691506129e1565b600101613f7c565b50506040805180820182529201518252505f602082018190529590945092505050565b5f614022614ce1565b604083015181526060850151515f5b818110156140ec576140c0898989606001515f8151811061405457614054615780565b60200260200101518960400151858151811061407257614072615780565b602002602001015160405180608001604052808b5f01516001600160a01b031681526020018b602001518152602001895f015181526020018b606001516001811115613dbd57613dbd6155ac565b90945092505f8460138111156140d8576140d86155ac565b036140e45750506129e1565b600101614031565b5050604080518082018252930151835250505f6020820152600c9590945092505050565b5f614119614ce1565b604083015181525f5b846040015151811015613e0b5761414a888888606001515f81518110613d5157613d51615780565b90935091505f836013811115614162576141626155ac565b146141875750506040805180820182529083015181525f6020820152600b91506129e1565b600101614122565b5f614198614ce1565b60408084015182528401515115806141b95750846060015151846040015151115b156141c757600d91506129e1565b5f805b8560400151518110156142fb575f805b8860600151518110156142c0576001811b84165f036142b0575f8061427c8d8d8d60600151868151811061421057614210615780565b60200260200101518d60400151898151811061422e5761422e615780565b602002602001015160405180608001604052808f5f01516001600160a01b031681526020018f6020015181526020018d5f015181526020018f606001516001811115613dbd57613dbd6155ac565b90925090505f826013811115614294576142946155ac565b036142ad57955050600180821b949094179391506142c0565b50505b6142b9816158e4565b90506141da565b50806142ea5750506040805180820182529085015181525f6020820152600d935091506129e19050565b506142f4816158e4565b90506141ca565b505f9250509550959350505050565b602082015160408301515f919082601083601f81111561432c5761432c6155ac565b146143445761433f8888875f01516149d5565b61436e565b6143578888875f01518860200151614a0c565b60405161436592919061590f565b60405180910390205b9050601083601f811115614384576143846155ac565b1480156143915750818114155b156143a25760079350505050611dbf565b601183601f8111156143b6576143b66155ac565b1480156143c35750818111155b156143d45760089350505050611dbf565b601283601f8111156143e8576143e86155ac565b1480156143f55750818110155b156144065760099350505050611dbf565b5f9350505050611dbf565b6020820151604083015182515f929190839061443090899089906149d5565b9050601383601f811115614446576144466155ac565b1480156144535750818113155b156144645760089350505050611dbf565b601483601f811115614478576144786155ac565b1480156143f557508181126144065760099350505050611dbf565b60408201515f90816001855160068111156144b0576144b06155ac565b149050365f6144fc8989856144c65760206144c8565b5f5b89516144d79160ff1690615c29565b866144e35760206144e5565b5f5b60ff168a602001516144f791906158fc565b614a0c565b909250905060f084901c81811061451b57600e95505050505050611dbf565b6001600160881b0319601086901b8116608887901b82165f61453f8686818a615ab6565b61454891615add565b9050818382161461455a57600f61455c565b5f5b9e9d5050505050505050505050505050565b5f614577614ce1565b5f856040015160601c90505f86604001515f1c60a01b90505f80836001600160a01b031663b0acb980885f015189602001518e8e8c606001518e5f01518f602001518b6040518963ffffffff1660e01b81526004016145dd989796959493929190615e5d565b6040805180830381865afa1580156145f7573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061461b9190615ebc565b915091508161462b57601061462d565b5f5b604080518082018252980151885260208801919091529a95995094975050505050505050565b5f61465c614ce1565b5f61466b8888875f01516149d5565b5f1c905061467e81878660400151614a28565b92509250509550959350505050565b5f614696614ce1565b6146a98360200151858560400151614a28565b90925090505f8260138111156146c1576146c16155ac565b146146cd5760136146cf565b5f5b91509250929050565b5f6146e1614ce1565b6146f16001858560400151614a28565b90925090505f826013811115614709576147096155ac565b146146cd5760126146cf565b80515f90600181600681111561472d5761472d6155ac565b0361473b5750600192915050565b600281600681111561474f5761474f6155ac565b148061476c5750600481600681111561476a5761476a6155ac565b145b8061478857506005816006811115614786576147866155ac565b145b806147a4575060068160068111156147a2576147a26155ac565b145b156147b157505f92915050565b6020830151515f5b818110156147f0576147da85602001518281518110613b8f57613b8f615780565b6147e857505f949350505050565b6001016147b9565b506001949350505050565b5f806148078486615c29565b9050821561481657905061482f565b6148218787836149d5565b61482b9086615c29565b9150505b95945050505050565b8151600181600681111561484e5761484e6155ac565b0361485e576020828101526149cb565b6002816006811115614872576148726155ac565b0361489f5761488a6148858787876149d5565b614b5a565b614895906020615c29565b60208301526149cb565b60038160068111156148b3576148b36155ac565b036148d1576148cc868686868760200151515f88613afe565b6149cb565b60048160068111156148e5576148e56155ac565b036149295761490e86866148fa876020615c29565b866149068b8b8b6149d5565b600188613afe565b6020826020018181516149219190615c29565b9052506149cb565b600581600681111561493d5761493d6155ac565b148061495a57506006816006811115614958576149586155ac565b145b156149cb576149ac86866005846006811115614978576149786155ac565b14614983575f614986565b60045b60ff16614994886020615c29565b61499e9190615c29565b868760200151515f88613afe565b6149ba6148858787876149d5565b6149c5906020615c29565b60208301525b5091909152505050565b5f826149e2836020615c29565b1115614a0157604051631d098e2d60e21b815260040160405180910390fd5b509190910135919050565b365f858486614a1b8683615c29565b92611c4d93929190615ab6565b5f614a31614ce1565b5f80614a41858760400151613ca9565b9150915080614a5257614a5261596c565b848281518110614a6457614a64615780565b6020026020010151602001516001600160801b0316858381518110614a8b57614a8b615780565b6020026020010151604001516001600160801b031688614aab9190615c29565b1115614aef5760116040518060400160405280878152602001878581518110614ad657614ad6615780565b60200260200101515f0151815250935093505050614b52565b614af885614b88565b945086858381518110614b0d57614b0d615780565b6020026020010151604001818151614b259190615cd8565b6001600160801b031690525050604080518082019091528481525f6020820181905293509150614b529050565b935093915050565b5f60206001614b698483615c29565b614b7391906158fc565b614b7d9190615ee8565b610887906020615e46565b8051606090806001600160401b03811115614ba557614ba5614ffc565b604051908082528060200260200182016040528015614bee57816020015b604080516060810182525f80825260208083018290529282015282525f19909201910181614bc35790505b5091505f5b8181101561271257838181518110614c0d57614c0d615780565b60200260200101515f0151838281518110614c2a57614c2a615780565b60200260200101515f018181525050838181518110614c4b57614c4b615780565b602002602001015160200151838281518110614c6957614c69615780565b6020026020010151602001906001600160801b031690816001600160801b031681525050838181518110614c9f57614c9f615780565b602002602001015160400151838281518110614cbd57614cbd615780565b60209081029190910101516001600160801b03909116604090910152600101614bf3565b60408051808201909152606081525f602082015290565b60408051608081019091525f808252602082019081526020015f5b8152602001606081525090565b60408051808201909152805f614d13565b6001600160a01b03811681146117e7575f80fd5b5f8060408385031215614d56575f80fd5b823591506020830135614d6881614d31565b809150509250929050565b5f60208284031215614d83575f80fd5b81356116af81614d31565b80356001600160e01b031981168114613af9575f80fd5b5f805f60608486031215614db7575f80fd5b8335614dc281614d31565b9250614dd060208501614d8e565b91506040840135614de081614d31565b809150509250925092565b5f60208284031215614dfb575f80fd5b5035919050565b6001600160a01b0391909116815260200190565b5f8083601f840112614e26575f80fd5b5081356001600160401b03811115614e3c575f80fd5b6020830191508360208285010111156125f9575f80fd5b600281106117e7575f80fd5b80151581146117e7575f80fd5b5f805f805f805f60c0888a031215614e82575f80fd5b8735614e8d81614d31565b96506020880135955060408801356001600160401b03811115614eae575f80fd5b614eba8a828b01614e16565b9096509450506060880135614ece81614e53565b92506080880135915060a0880135614ee581614e5f565b8091505092959891949750929550565b5f5b83811015614f0f578181015183820152602001614ef7565b50505f910152565b5f8151808452614f2e816020860160208601614ef5565b601f01601f19169290920160200192915050565b8215158152604060208201525f611dbf6040830184614f17565b5f805f805f60808688031215614f70575f80fd5b8535614f7b81614d31565b94506020860135935060408601356001600160401b03811115614f9c575f80fd5b614fa888828901614e16565b9094509250506060860135614fbc81614e53565b809150509295509295909350565b5f805f60608486031215614fdc575f80fd5b833592506020840135614fee81614d31565b91506127b760408501614d8e565b634e487b7160e01b5f52604160045260245ffd5b604051608081016001600160401b038111828210171561503257615032614ffc565b60405290565b60405160a081016001600160401b038111828210171561503257615032614ffc565b604051601f8201601f191681016001600160401b038111828210171561508257615082614ffc565b604052919050565b5f6001600160401b038211156150a2576150a2614ffc565b5060051b60200190565b803560208110613af9575f80fd5b5f6001600160401b038211156150d2576150d2614ffc565b50601f01601f191660200190565b5f82601f8301126150ef575f80fd5b81356151026150fd826150ba565b61505a565b818152846020838601011115615116575f80fd5b816020850160208301375f918101602001919091529392505050565b803560048110613af9575f80fd5b5f805f805f60a08688031215615154575f80fd5b853594506151656020870135614d31565b6020860135935061517860408701614d8e565b92506001600160401b0360608701351115615191575f80fd5b6060860135860187601f8201126151a6575f80fd5b6151b36150fd823561508a565b81358082526020808301929160051b8401018a8111156151d1575f80fd5b602084015b81811015615293576001600160401b03813511156151f2575f80fd5b803585016080818e03601f19011215615209575f80fd5b615211615010565b602082013560ff811614615223575f80fd5b60208201358152600760408301351061523a575f80fd5b60408201356020820152615250606083016150ac565b60408201526001600160401b036080830135111561526c575f80fd5b61527f8e602060808501358501016150e0565b6060820152855250602093840193016151d6565b50508094505050506152a760808701615132565b90509295509295909350565b5f805f606084860312156152c5575f80fd5b8335925060208401356152d781614d31565b91506127b760408501615132565b5f80604083850312156152f6575f80fd5b823561530181614d31565b946020939093013593505050565b5f8083601f84011261531f575f80fd5b5081356001600160401b03811115615335575f80fd5b6020830191508360208260051b85010111156125f9575f80fd5b5f805f805f60608688031215615363575f80fd5b853561536e81614d31565b945060208601356001600160401b0380821115615389575f80fd5b61539589838a0161530f565b909650945060408801359150808211156153ad575f80fd5b506153ba8882890161530f565b969995985093965092949392505050565b5f602082840312156153db575f80fd5b81356001600160401b038111156153f0575f80fd5b611dbf848285016150e0565b80356001600160801b0381168114613af9575f80fd5b80356001600160401b0381168114613af9575f80fd5b5f805f805f8060c0878903121561543d575f80fd5b8635955061544d602088016153fc565b945061545b604088016153fc565b9350615469606088016153fc565b925061547760808801615412565b915061548560a08801615412565b90509295509295509295565b5f805f80608085870312156154a4575f80fd5b8435935060208501356154b681614d31565b92506154c460408601614d8e565b91506154d260608601615132565b905092959194509250565b604080825283519082018190525f906020906060840190828701845b8281101561551e5781516001600160a01b0316845292840192908401906001016154f9565b5050506001600160a01b039490941692019190915250919050565b5f805f6040848603121561554b575f80fd5b83356001600160401b03811115615560575f80fd5b61556c86828701614e16565b909790965060209590950135949350505050565b5f8060408385031215615591575f80fd5b823561559c81614d31565b91506020830135614d6881614d31565b634e487b7160e01b5f52602160045260245ffd5b600781106155d0576155d06155ac565b9052565b602081106155d0576155d06155ac565b5f6020808301818452808551808352604092508286019150828160051b8701018488015f5b8381101561567357603f198984030185528151608060ff8251168552888201516156358a8701826155c0565b5087820151615646898701826155d4565b5060609182015191850181905261565f85820183614f17565b968901969450505090860190600101615609565b509098975050505050505050565b600481106155d0576155d06155ac565b5f60a08201878352602060018060a01b03881681850152604063ffffffff60e01b881681860152606060a08187015283885180865260c08801915060c08160051b8901019550848a015f5b828110156157455760bf198a89030184528151608060ff8251168a52888201516157088a8c01826155c0565b5087820151615719898c01826155d4565b5086820151915080878b0152615731818b0183614f17565b9950505092860192908601906001016156dc565b5050505050505080915050611a6d6080830184615681565b8381526001600160a01b038316602082015260608101611dbf6040830184615681565b634e487b7160e01b5f52603260045260245ffd5b5f602082840312156157a4575f80fd5b81356116af81614e5f565b634e487b7160e01b5f52601160045260245ffd5b5f61ffff8083168181036157d9576157d96157af565b6001019392505050565b6001600160a01b0386168152606060208083018290529082018590525f906001600160fb1b03861115615814575f80fd5b8560051b80886080860137830183810360809081016040860152810185905285905f9060a0015b8682101561586457823561584e81614e5f565b151581529183019160019190910190830161583b565b9a9950505050505050505050565b5f805f60608486031215615884575f80fd5b835161588f81614d31565b60208501519093506158a081614d31565b6040850151909250614de081614d31565b8481526001600160a01b03841660208201526001600160e01b0319831660408201526080810161482f6060830184615681565b5f600182016158f5576158f56157af565b5060010190565b81810381811115610887576108876157af565b818382375f9101908152919050565b6001600160e01b031981358181169160048510156159465780818660040360031b1b83161692505b505092915050565b6040810160148410615962576159626155ac565b9281526020015290565b634e487b7160e01b5f52600160045260245ffd5b6001600160801b03828116828216039080821115612f5e57612f5e6157af565b600281106155d0576155d06155ac565b60018060a01b0385168152836020820152608060408201525f6159d66080830185614f17565b905061482f60608301846159a0565b5f82601f8301126159f4575f80fd5b8151615a026150fd826150ba565b818152846020838601011115615a16575f80fd5b611dbf826020830160208701614ef5565b5f8060408385031215615a38575f80fd5b8251615a4381614e5f565b60208401519092506001600160401b03811115615a5e575f80fd5b6125f5858286016159e5565b5f60208284031215615a7a575f80fd5b81516116af81614e5f565b5f60208284031215615a95575f80fd5b81516001600160401b03811115615aaa575f80fd5b611dbf848285016159e5565b5f8085851115615ac4575f80fd5b83861115615ad0575f80fd5b5050820193919092039150565b80356020831015610887575f19602084900360031b1b1692915050565b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b60018060a01b0386168152846020820152608060408201525f615b49608083018587615afa565b9050611a6d60608301846159a0565b5f6020808385031215615b69575f80fd5b82516001600160401b03811115615b7e575f80fd5b8301601f81018513615b8e575f80fd5b8051615b9c6150fd8261508a565b81815260a09182028301840191848201919088841115615bba575f80fd5b938501935b838510156113fc5780858a031215615bd6575f8081fd5b615bde615038565b8551615be981614e53565b815285870151615bf881614d31565b8188015260408681015190820152606080870151908201526080808701519082015283529384019391850191615bbf565b80820180821115610887576108876157af565b6001600160401b03818116838216019080821115612f5e57612f5e6157af565b6001600160401b03828116828216039080821115612f5e57612f5e6157af565b634e487b7160e01b5f52601260045260245ffd5b5f6001600160401b0380841680615ca957615ca9615c7c565b92169190910492915050565b6001600160801b03818116838216028082169190828114615946576159466157af565b6001600160801b03818116838216019080821115612f5e57612f5e6157af565b6001600160401b03818116838216028082169190828114615946576159466157af565b604081525f615d2d6040830185614f17565b90508260208301529392505050565b5f60208284031215615d4c575f80fd5b81516116af81614d31565b6001600160f81b031981358181169160018510156159465760019490940360031b84901b1690921692915050565b838152604060208201525f611dbc604083018486615afa565b5f8251615daf818460208701614ef5565b9190910192915050565b805160208201516001600160e01b03198082169291906004831015615de85780818460040360031b1b83161693505b505050919050565b606360f81b815260e083901b6001600160e01b03191660018201526880600e6000396000f360b81b60058201525f600e82018190528251615e3881600f850160208701614ef5565b91909101600f019392505050565b8082028115828204841417610887576108876157af565b60018060a01b038916815287602082015260e060408201525f615e8460e08301888a615afa565b9050615e9360608301876159a0565b608082019490945260a08101929092526001600160a01b03191660c09091015295945050505050565b5f8060408385031215615ecd575f80fd5b8251615ed881614e5f565b6020939093015192949293505050565b5f82615ef657615ef6615c7c565b50049056fea15bc60c955c405d20d9149c709e2460f1c2d9a497496a7f46004d1772c3054ca2646970667358221220effee86583e9a9dfea71c1020808e6a7f1ab205668c8679fce5a2d2485ca407b64736f6c63430008150033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001
-----Decoded View---------------
Arg [0] : _owner (address): 0x0000000000000000000000000000000000000001
Arg [1] : _avatar (address): 0x0000000000000000000000000000000000000001
Arg [2] : _target (address): 0x0000000000000000000000000000000000000001
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000001
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.