ETH Price: $2,083.30 (-2.81%)

Contract

0x91eFB982D8D92c43A6778C5699CeFc6f06B1BeBb
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

1 Internal Transaction found.

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Method Block
From
To
0x3d602d80204679372024-08-06 7:08:23576 days ago1722928103  Contract Creation0 ETH
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Minimal Proxy Contract for 0xc88c5f002523506284d6598bb1d27b69ba5d63cd

Contract Name:
CaclAuthorizer

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.19;

import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

import "../base/BaseSimpleAuthorizer.sol";

import "./CaclTypes.sol";
import "./Handlers.sol";
import "./AbiExprLib.sol";

contract CaclAuthorizer is BaseSimpleAuthorizer {
    using EnumerableSet for EnumerableSet.Bytes32Set;
    using EnumerableSet for EnumerableSet.AddressSet;
    using ExprLib for Expression;
    using RuleLib for Rule;
    using OpLib for uint8;
    using SolidityTypeLib for uint8;

    bytes32 public constant NAME = "CaclAuthorizer";
    bytes32 public constant override TYPE = "VM";
    uint256 public constant VERSION = 2;

    // Variables
    EnumerableSet.Bytes32Set internal varNames;
    mapping(bytes32 => address) internal variables;

    // Rules
    EnumerableSet.AddressSet internal rules;

    event VariableAdded(bytes32 indexed name);
    event VariableRemoved(bytes32 indexed name);
    event RuleAdded(address indexed id);
    event RuleRemoved(address indexed id);

    constructor(address _owner, address _caller) BaseSimpleAuthorizer(_owner, _caller) {}

    // For variables.
    function addVariable(bytes32 name, Expression calldata expr) external onlyOwner {
        varNames.add(name);
        variables[name] = expr.store();
        emit VariableAdded(name);
    }

    function removeVariable(bytes32 name) external onlyOwner {
        varNames.remove(name);
        delete variables[name];
        emit VariableRemoved(name);
    }

    function hasVariable(bytes32 name) public view returns (bool) {
        return varNames.contains(name);
    }

    function getVariable(bytes32 name) public view returns (Expression memory) {
        require(hasVariable(name), "Variable not exists");
        return ExprLib.load(variables[name]);
    }

    function getVariablesCount() external view returns (uint256) {
        return varNames.length();
    }

    // For rules.
    function addRule(Rule calldata rule) external onlyOwner returns (address id) {
        id = rule.store();
        rules.add(id);
        emit RuleAdded(id);
    }

    function removeRule(address id) external onlyOwner {
        require(rules.remove(id), "Rule not exists");
        emit RuleRemoved(id);
    }

    function removeRule(Rule calldata rule) external onlyOwner {
        address id = rule.getAddress();
        require(rules.remove(id), "Rule not exists");
        emit RuleRemoved(id);
    }

    function hasRule(address id) public view returns (bool) {
        return rules.contains(id);
    }

    function _getRule(address id) internal view returns (Rule memory rule) {
        rule = RuleLib.load(id);
    }

    function getRule(address id) public view returns (Rule memory rule) {
        require(hasRule(id), "Rule not exists");
        rule = _getRule(id);
    }

    function getRulesCount() external view returns (uint256) {
        return rules.length();
    }

    function getRules(uint256 start, uint256 end) external view returns (Rule[] memory ret) {
        uint256 count = rules.length();
        end = end > count ? count : end;
        ret = new Rule[](end - start);
        for (uint256 i = start; i < end; i++) {
            ret[i - start] = _getRule(rules.at(i));
        }
    }

    // For checks.

    function getRuleHint(TransactionData calldata transaction) public view returns (address) {
        uint256 count = rules.length();
        for (uint i = 0; i < count; i++) {
            address id = rules.at(i);
            if (runRule(transaction, id)) {
                return id;
            }
        }
        return address(0);
    }

    function _preExecCheck(
        TransactionData calldata transaction
    ) internal view override returns (AuthorizerReturnData memory authData) {
        address hintId;
        bool result;
        if (transaction.hint.length >= 32) {
            hintId = abi.decode(transaction.hint, (address));
        }
        if (hintId == address(0)) {
            hintId = getRuleHint(transaction);
            result = hintId != address(0);
        } else {
            result = runRule(transaction, hintId);
        }
        if (result) {
            return AuthorizerReturnData(AuthResult.SUCCESS, "", abi.encode(hintId));
        } else {
            return AuthorizerReturnData(AuthResult.FAILED, "No rules pass", "");
        }
    }

    function getReservedNamedValue(
        bytes32 name,
        TransactionData calldata transaction
    ) public view returns (bytes memory data) {
        if (name == "tx.sender") {
            return abi.encode(transaction.from);
        } else if (name == "tx.to") {
            return abi.encode(transaction.to);
        } else if (name == "tx.selector") {
            bytes4 selector = bytes4(transaction.data[0:4]);
            return abi.encode(selector);
        } else if (name == "tx.delegate") {
            return abi.encode(transaction.delegate);
        } else if (name == "tx.value") {
            return abi.encode(transaction.value);
        } else if (name == "block.timestamp") {
            return abi.encode(block.timestamp);
        } else {
            return data; // empty data
        }
    }

    function evalRef(TransactionData calldata transaction, bytes32 name) public view returns (bytes memory data) {
        data = getReservedNamedValue(name, transaction);
        if (data.length > 0) return data;
        Expression memory v = getVariable(name);
        require(v.data.length > 0, "name not found");
        return v.data;
    }

    function getRawData(
        TransactionData calldata transaction,
        Expression memory expr
    ) public view returns (bytes memory data) {
        uint8 op = expr.getOp();
        if (op == CONST) {
            return expr.data;
        } else if (op == VAR_NAME) {
            require(expr.data.length == 32, "Invalid name data");
            bytes32 name = abi.decode(expr.data, (bytes32));
            return evalRef(transaction, name);
        } else if (op == ABI_EXPR) {
            data = evalAbiExpr(transaction.data[4:], expr.data);
        } else {
            // Only boolean expression in this case.
            bool value = evalBoolExpr(transaction, expr);
            return abi.encode(value);
        }
    }

    function evalBoolExpr(TransactionData calldata transaction, Expression memory expr) public view returns (bool) {
        uint8 op = expr.getOp();
        uint8 typ = expr.getType();

        require(typ == BOOL, "Not bool expr");
        if (op.isDataOp()) {
            bytes memory data = getRawData(transaction, expr);
            require(data.length == 32, "Invalid bool data");
            return abi.decode(expr.data, (bool));
        } else if (op.isCmpOp()) {
            (Expression memory v1, Expression memory v2) = abi.decode(expr.data, (Expression, Expression));
            uint8 v1Type = v1.getType();
            uint8 v2Type = v2.getType();
            require(v1Type == v2Type, "Invalid opnds type for cmp");
            return handleCmpRawData(op, v1Type, getRawData(transaction, v1), getRawData(transaction, v2));
        } else if (op.isArrayOp()) {
            (Expression memory v1, Expression memory v2) = abi.decode(expr.data, (Expression, Expression));
            uint8 v1Type = v1.getType();
            uint8 v2Type = v2.getType();
            require(v2Type.isArray(), "V2 type not array in array op");
            require(v1Type.baseType() == v2Type.baseType(), "Type not match in array op");

            return handleArrayRawData(op, v1Type, getRawData(transaction, v1), getRawData(transaction, v2));
        } else if (op == AND) {
            Expression[] memory boolExprs = abi.decode(expr.data, (Expression[]));
            for (uint i = 0; i < boolExprs.length; ++i) {
                if (!evalBoolExpr(transaction, boolExprs[i])) return false; // Short circuit
            }
            return true;
        } else if (op == OR) {
            Expression[] memory boolExprs = abi.decode(expr.data, (Expression[]));
            for (uint i = 0; i < boolExprs.length; ++i) {
                if (evalBoolExpr(transaction, boolExprs[i])) return true; // Short circuit
            }
            return false;
        } else if (op == NOT) {
            Expression memory v1 = abi.decode(expr.data, (Expression));
            return !evalBoolExpr(transaction, v1);
        } else {
            revert("Invalid op met");
        }
    }

    function runRule(TransactionData calldata transaction, address id) public view returns (bool) {
        Rule memory rule = getRule(id);
        uint count = rule.exprs.length;
        if (count == 0) {
            // Rule not exist or is invalid.
            return false;
        }
        for (uint i = 0; i < count; i++) {
            if (!evalBoolExpr(transaction, rule.exprs[i])) {
                return false;
            }
        }
        // All exprs must pass.
        return true;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastValue;
                // Update the index for the moved value
                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.19;

import "./BaseOwnable.sol";
import "../Errors.sol";
import "../../interfaces/IAuthorizer.sol";
import "../../interfaces/IAccount.sol";
import "../../interfaces/IRoleManager.sol";

/// @title BaseSimpleAuthorizer - A simple ownable authorizer
/// @author Cobo Safe Dev Team https://www.cobo.com/
/// @dev Simplified `BaseAuthorizer`:
///      1. `preExecCheck` is view function thus no storage write is allowed.
///      2. Void `postExecCheck/preExecProcess/postExecProcess` implementation.
///      3. `pause` removed.
///      4. `caller` check removed.
///      5. `account` removed, thus no roles check.
///
abstract contract BaseSimpleAuthorizer is IAuthorizer, BaseOwnable {
    // Often used for off-chain system.
    // Each contract instance has its own value.
    bytes32 public tag;

    event TagSet(bytes32 indexed tag);

    constructor(address _owner, address _caller) BaseOwnable(_owner) {
        (_caller);
    }

    /// @dev Compatible to ArgusAccountHelper.createAuthorizer.
    // `_caller` is in the argument list but not actually used.
    function initialize(address _owner, address _caller) public {
        initialize(_owner);
        (_caller);
    }

    function initialize(address _owner, address _caller, address _account) external {
        initialize(_owner, _caller);
        (_account);
    }

    /// @notice Change the tag for the contract instance.
    /// @dev For off-chain index.
    /// @param _tag the tag
    function setTag(bytes32 _tag) external onlyOwner {
        tag = _tag;
        emit TagSet(_tag);
    }

    function preExecCheck(
        TransactionData calldata transaction
    ) external view virtual returns (AuthorizerReturnData memory authData) {
        return _preExecCheck(transaction);
    }

    function postExecCheck(
        TransactionData calldata transaction,
        TransactionResult calldata callResult,
        AuthorizerReturnData calldata preData
    ) external pure returns (AuthorizerReturnData memory authData) {
        (transaction, callResult, preData);
        authData.result = AuthResult.SUCCESS;
    }

    function preExecProcess(TransactionData calldata transaction) external pure {
        (transaction);
    }

    function postExecProcess(
        TransactionData calldata transaction,
        TransactionResult calldata callResult
    ) external pure {
        (transaction, callResult);
    }

    /// @dev Override this if you implement new type of authorizer.
    function TYPE() external view virtual returns (bytes32) {
        return AuthType.COMMON;
    }

    /// @dev Default flag for BaseSimpleAuthorizer. Can be overrided by sub contract.
    function flag() external view virtual override returns (uint256) {
        return AuthFlags.SIMPLE_MODE;
    }

    /// @dev Implement this function to extend this contract.
    function _preExecCheck(
        TransactionData calldata transaction
    ) internal view virtual returns (AuthorizerReturnData memory authData);
}

// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.19;

import "../base/BaseSimpleAuthorizer.sol";
import "./WriteOnce.sol";

// Solidity type
uint8 constant BYTES = 0x1; // bytes, string
uint8 constant UINT = 0x2; // uint8~uint256, bytes1~bytes32
uint8 constant INT = 0x3; // int8~int256
uint8 constant BOOL = 0x4;
uint8 constant ADDRESS = 0x5;

uint8 constant ARRAY = 0x10; // array bit.
uint8 constant BYTES_ARRAY = BYTES | ARRAY;
uint8 constant UINT_ARRAY = UINT | ARRAY;
uint8 constant INT_ARRAY = INT | ARRAY;
uint8 constant BOOL_ARRAY = BOOL | ARRAY;
uint8 constant ADDRESS_ARRAY = ADDRESS | ARRAY;

library SolidityTypeLib {
    function isArray(uint8 typ) internal pure returns (bool) {
        return typ & ARRAY == ARRAY;
    }

    function baseType(uint8 typ) internal pure returns (uint8) {
        return typ & 0xf;
    }
}

// Expression op
uint8 constant CONST = 0x1; // type + bytes.
uint8 constant VAR_NAME = 0x2; // type + name
uint8 constant ABI_EXPR = 0x3; // type + ABI expression

uint8 constant EQ = 0x10; // v1 == v2
uint8 constant NE = 0x11; // v1 != v2
uint8 constant GT = 0x12; // v1 > v2
uint8 constant GE = 0x13; // v1 >= v2
uint8 constant LT = 0x14; // v1 < v2
uint8 constant LE = 0x15; // v1 <= v2

uint8 constant IN = 0x20; // v1 in [...]
uint8 constant NOT_IN = 0x21; // v1 not in [...]

uint8 constant AND = 0x31; // v1 and v2
uint8 constant OR = 0x32; // v1 or v2

uint8 constant NOT = 0x41; // not v1

library OpLib {
    function isDataOp(uint8 op) internal pure returns (bool) {
        return op >= CONST && op <= ABI_EXPR;
    }

    function isCmpOp(uint8 op) internal pure returns (bool) {
        return op >= EQ && op <= LE;
    }

    function isArrayOp(uint8 op) internal pure returns (bool) {
        return op >= IN && op <= NOT_IN;
    }
}

struct Expression {
    uint256 flag;
    bytes data;
}

library ExprLib {
    function getOp(Expression memory expr) internal pure returns (uint8 op) {
        op = uint8(expr.flag & 0xff);
    }

    function getType(Expression memory expr) internal pure returns (uint8 typ) {
        typ = uint8((expr.flag >> 8) & 0xff);
    }

    function getAddress(Expression memory expr) internal view returns (address) {
        return WriteOnce.getPointer(abi.encode(expr));
    }

    function store(Expression memory expr) internal returns (address) {
        return WriteOnce.store(abi.encode(expr));
    }

    function load(address id) internal view returns (Expression memory expr) {
        expr = abi.decode(WriteOnce.load(id), (Expression));
    }

    function packFlag(uint8 op, uint8 typ) internal pure returns (uint256 flag) {
        flag |= uint256(op);
        flag |= uint256(typ) << 8;
    }

    function makeConst(uint256 value) internal pure returns (Expression memory expr) {
        expr.flag = packFlag(CONST, UINT);
        expr.data = abi.encode(value);
    }

    function makeConst(int256 value) internal pure returns (Expression memory expr) {
        expr.flag = packFlag(CONST, INT);
        expr.data = abi.encode(value);
    }

    function makeConst(address value) internal pure returns (Expression memory expr) {
        expr.flag = packFlag(CONST, ADDRESS);
        expr.data = abi.encode(value);
    }

    function makeConst(bool value) internal pure returns (Expression memory expr) {
        expr.flag = packFlag(CONST, BOOL);
        expr.data = abi.encode(value);
    }

    function makeConst(bytes memory value) internal pure returns (Expression memory expr) {
        expr.flag = packFlag(CONST, BYTES);
        expr.data = abi.encode(value);
    }

    function makeName(bytes32 name, uint8 typ) internal pure returns (Expression memory expr) {
        expr.flag = packFlag(VAR_NAME, typ);
        expr.data = abi.encode(name);
    }
}

struct Rule {
    Expression[] exprs;
}

library RuleLib {
    function getAddress(Rule memory rule) internal view returns (address) {
        return WriteOnce.getPointer(abi.encode(rule));
    }

    function store(Rule memory rule) internal returns (address) {
        return WriteOnce.store(abi.encode(rule));
    }

    function load(address id) internal view returns (Rule memory rule) {
        rule = abi.decode(WriteOnce.load(id), (Rule));
    }
}

// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.19;

import "@openzeppelin/contracts/utils/Strings.sol";

import "./CaclTypes.sol";

// Comparison handlers

function raiseOpError(uint8 _op, string memory _type) pure {
    revert(string(abi.encodePacked("Unsupported op ", Strings.toString(uint256(_op)), " for type ", _type)));
}

function raiseTypeError(uint8 _type, string memory _op) pure {
    revert(string(abi.encodePacked("Unsupported type ", Strings.toString(uint256(_type)), " for op ", _op)));
}

function handleCmp(uint8 op, bytes memory v1, bytes memory v2) pure returns (bool) {
    if (op == EQ) return keccak256(v1) == keccak256(v2);
    if (op == NE) return keccak256(v1) != keccak256(v2);
    raiseOpError(op, "bytes");
}

function handleCmp(uint8 op, bool v1, bool v2) pure returns (bool) {
    if (op == EQ) return v1 == v2;
    if (op == NE) return v1 != v2;
    raiseOpError(op, "bool");
}

function handleCmp(uint8 op, address v1, address v2) pure returns (bool) {
    if (op == EQ) return v1 == v2;
    if (op == NE) return v1 != v2;
    raiseOpError(op, "address");
}

function handleCmp(uint8 op, uint256 v1, uint256 v2) pure returns (bool) {
    if (op == EQ) return v1 == v2;
    if (op == NE) return v1 != v2;
    if (op == GT) return v1 > v2;
    if (op == GE) return v1 >= v2;
    if (op == LT) return v1 < v2;
    if (op == LE) return v1 <= v2;
    raiseOpError(op, "uint256");
}

function handleCmp(uint8 op, int256 v1, int256 v2) pure returns (bool) {
    if (op == EQ) return v1 == v2;
    if (op == NE) return v1 != v2;
    if (op == GT) return v1 > v2;
    if (op == GE) return v1 >= v2;
    if (op == LT) return v1 < v2;
    if (op == LE) return v1 <= v2;
    raiseOpError(op, "int256");
}

function handleCmpRawData(uint8 op, uint8 typ, bytes memory v1Data, bytes memory v2Data) pure returns (bool) {
    if (typ == ADDRESS) {
        address v1 = abi.decode(v1Data, (address));
        address v2 = abi.decode(v2Data, (address));
        return handleCmp(op, v1, v2);
    } else if (typ == UINT) {
        uint256 v1 = abi.decode(v1Data, (uint256));
        uint256 v2 = abi.decode(v2Data, (uint256));
        return handleCmp(op, v1, v2);
    } else if (typ == INT) {
        int256 v1 = abi.decode(v1Data, (int256));
        int256 v2 = abi.decode(v2Data, (int256));
        return handleCmp(op, v1, v2);
    } else if (typ == BOOL) {
        bool v1 = abi.decode(v1Data, (bool));
        bool v2 = abi.decode(v2Data, (bool));
        return handleCmp(op, v1, v2);
    } else if (typ == BYTES) {
        // No need to abi.decode
        return handleCmp(op, v1Data, v2Data);
    }
    raiseTypeError(typ, "cmp");
}

function handleBool(uint8 op, bool v1, bool v2) pure returns (bool) {
    if (op == AND) return v1 && v2;
    if (op == OR) return v1 || v2;
    raiseOpError(op, "bool");
}

function handleNot(bool v1) pure returns (bool) {
    return !v1;
}

// Element in array.

function handleIn(bytes memory v1, bytes[] memory v2) pure returns (bool) {
    for (uint i = 0; i < v2.length; i++) {
        if (keccak256(v1) == keccak256(v2[i])) return true;
    }
    return false;
}

function handleIn(uint256 v1, uint256[] memory v2) pure returns (bool) {
    for (uint i = 0; i < v2.length; i++) {
        if (v1 == v2[i]) return true;
    }
    return false;
}

function handleIn(int256 v1, int256[] memory v2) pure returns (bool) {
    for (uint i = 0; i < v2.length; i++) {
        if (v1 == v2[i]) return true;
    }
    return false;
}

function handleIn(address v1, address[] memory v2) pure returns (bool) {
    for (uint i = 0; i < v2.length; i++) {
        if (v1 == v2[i]) return true;
    }
    return false;
}

// Array in array.

function handleIn(bytes[] memory v1, bytes[] memory v2) pure returns (bool) {
    // Check if all elements of v1 are in v2.
    for (uint i = 0; i < v1.length; i++) {
        if (!handleIn(v1[i], v2)) return false;
    }
    return true;
}

function handleIn(uint256[] memory v1, uint256[] memory v2) pure returns (bool) {
    // Check if all elements of v1 are in v2.
    for (uint i = 0; i < v1.length; i++) {
        if (!handleIn(v1[i], v2)) return false;
    }
    return true;
}

function handleIn(int256[] memory v1, int256[] memory v2) pure returns (bool) {
    // Check if all elements of v1 are in v2.
    for (uint i = 0; i < v1.length; i++) {
        if (!handleIn(v1[i], v2)) return false;
    }
    return true;
}

function handleIn(address[] memory v1, address[] memory v2) pure returns (bool) {
    // Check if all elements of v1 are in v2.
    for (uint i = 0; i < v1.length; i++) {
        if (!handleIn(v1[i], v2)) return false;
    }
    return true;
}

function handleArrayRawData(uint8 op, uint8 typ, bytes memory v1Data, bytes memory v2Data) pure returns (bool result) {
    // Put the most commonly used ones at the front.
    if (typ == ADDRESS) {
        address v1 = abi.decode(v1Data, (address));
        address[] memory v2 = abi.decode(v2Data, (address[]));
        result = handleIn(v1, v2);
    } else if (typ == ADDRESS_ARRAY) {
        // Used often,
        address[] memory v1 = abi.decode(v1Data, (address[]));
        address[] memory v2 = abi.decode(v2Data, (address[]));
        result = handleIn(v1, v2);
    } else if (typ == UINT) {
        uint256 v1 = abi.decode(v1Data, (uint256));
        uint256[] memory v2 = abi.decode(v2Data, (uint256[]));
        result = handleIn(v1, v2);
    } else if (typ == INT) {
        int256 v1 = abi.decode(v1Data, (int256));
        int256[] memory v2 = abi.decode(v2Data, (int256[]));
        result = handleIn(v1, v2);
    } else if (typ == BYTES) {
        bytes memory v1 = v1Data;
        bytes[] memory v2 = abi.decode(v2Data, (bytes[]));
        result = handleIn(v1, v2);
    } else if (typ == UINT_ARRAY) {
        uint256[] memory v1 = abi.decode(v1Data, (uint256[]));
        uint256[] memory v2 = abi.decode(v2Data, (uint256[]));
        result = handleIn(v1, v2);
    } else if (typ == INT_ARRAY) {
        int256[] memory v1 = abi.decode(v1Data, (int256[]));
        int256[] memory v2 = abi.decode(v2Data, (int256[]));
        result = handleIn(v1, v2);
    } else if (typ == BYTES_ARRAY) {
        bytes[] memory v1 = abi.decode(v1Data, (bytes[]));
        bytes[] memory v2 = abi.decode(v2Data, (bytes[]));
        result = handleIn(v1, v2);
    } else {
        raiseTypeError(typ, "in/not in");
    }
    if (op == NOT_IN) {
        result = !result;
    } else {
        if (op != IN) raiseOpError(op, "array");
    }
}

// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.19;

/*

    https://ethereum.stackexchange.com/questions/1106/is-there-a-limit-for-transaction-size
    calldata max length < 800k < uint32 max

    uint8 flag           uint32
    ------
    move,                offset                    -> ptr += offset
    jump,                offset                    -> ptr += ptr[offset]
    index-move,          index(int), element_size  -> ptr += 32 + (index > 0? index: index + ptr[0]) * element_size
    index-jump           index(int), element_size  -> ptr += 32 + ptr[32 + (index > 0? index: index + ptr[0]) * element_size]
    extract-static,      size                      -> return [ptr: ptr+size]
    extract-end,                                   -> return \x20, [ptr: end] as dynamic size, just extract all.
    extract-elements,    element_size              -> return [ptr + 32: ptr 32 + ptr[0] * element_size]

*/
function getUint256(bytes calldata data, uint256 offset) pure returns (uint256 value) {
    value = uint256(bytes32(data[offset:offset + 32]));
}

function getUint32(bytes memory path, uint256 offset) pure returns (uint256 value) {
    value = uint256(uint8(bytes1(path[offset])));
    value = (value << 8) | uint256(uint8(bytes1(path[offset + 1])));
    value = (value << 8) | uint256(uint8(bytes1(path[offset + 2])));
    value = (value << 8) | uint256(uint8(bytes1(path[offset + 3])));
}

function getInt32(bytes memory path, uint256 offset) pure returns (int256 value) {
    value = int256(getUint32(path, offset));
    if (value > 0x80000000) {
        value = value - 0x100000000;
    }
}

function evalAbiExpr(bytes calldata data, bytes memory path) pure returns (bytes memory extractedBytes) {
    uint256 ptr = 0;
    uint256 i = 0;
    uint8 op = 0;
    uint256 pathLen = path.length;
    uint256 offset = 0;
    int256 index = 0;
    uint256 size = 0;
    uint256 elementSize = 0;

    while (i < pathLen) {
        op = uint8(path[i]);
        ++i;
        if (op == 1) {
            // move(offset): ptr += offset
            offset = getUint32(path, i);
            ptr += offset;
            i += 4;
        } else if (op == 2) {
            // jump(offset): ptr += ptr[offset]
            offset = getUint32(path, i);
            i += 4;
            ptr += getUint256(data, ptr + offset);
        } else if (op == 3) {
            // index_move(index, element_size): ptr += 32 + (index > 0? index: index + ptr[0]) * element_size
            index = getInt32(path, i);
            i += 4;
            elementSize = getUint32(path, i);
            i += 4;
            size = getUint256(data, ptr);
            if (index < 0) {
                index += int256(size);
            }
            require(index >= 0, "Invalid move index");
            offset = 32 + uint256(index) * elementSize;
            ptr += offset;
        } else if (op == 4) {
            // index_jump(index, element_size): ptr += 32 + ptr[32 + (index > 0? index: index + ptr[0]) * element_size]
            index = getInt32(path, i);
            i += 4;
            elementSize = getUint32(path, i);
            i += 4;
            size = getUint256(data, ptr);
            if (index < 0) {
                index += int256(size);
            }
            offset = 32 + uint256(index) * elementSize;
            ptr += 32 + getUint256(data, ptr + offset);
        } else if (op == 5) {
            // extract-static(size): return [ptr: ptr+size]
            size = getUint32(path, i);
            // we will return here, no need to update i
            return data[ptr:ptr + size];
        } else if (op == 6) {
            // extract-end(): return \x20, [ptr: end] as dynamic size, just extract all.
            return abi.encodePacked(abi.encode(0x20), data[ptr:]);
        } else if (op == 7) {
            // extract-elements(element_size): return [ptr + 32: ptr 32 + ptr[0] * element_size]
            elementSize = getUint32(path, i);
            size = getUint256(data, ptr);
            // we will return here, no need to update i
            return data[ptr + 32:ptr + 32 + size * elementSize];
        } else {
            revert("Invalid abi expr op");
        }
    }

    revert("Empty abi expr");
}

// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.19;

import "../Errors.sol";
import "./BaseVersion.sol";

import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

/// @title BaseOwnable - Simple ownership access control contract.
/// @author Cobo Safe Dev Team https://www.cobo.com/
/// @dev Can be used in both proxy and non-proxy mode.
abstract contract BaseOwnable is BaseVersion {
    using SafeERC20 for IERC20;

    address public owner;
    address public pendingOwner;
    bool private initialized = false;

    event PendingOwnerSet(address indexed to);
    event NewOwnerSet(address indexed owner);

    modifier onlyOwner() {
        require(owner == msg.sender, Errors.CALLER_IS_NOT_OWNER);
        _;
    }

    /// @dev `owner` is set by argument, thus the owner can any address.
    ///      When used in non-proxy mode, `initialize` can not be called
    ///      after deployment.
    constructor(address _owner) {
        initialize(_owner);
    }

    /// @dev When used in proxy mode, `initialize` can be called by anyone
    ///      to claim the ownership.
    ///      This function can be called only once.
    function initialize(address _owner) public {
        require(!initialized, "Already initialized");
        _setOwner(_owner);
        initialized = true;
    }

    /// @notice User should ensure the corrent owner address set, or the
    ///         ownership may be transferred to blackhole. It is recommended to
    ///         take a safer way with setPendingOwner() + acceptOwner().
    function transferOwnership(address newOwner) external onlyOwner {
        require(newOwner != address(0), "New Owner is zero");
        _setOwner(newOwner);
    }

    /// @notice The original owner calls `setPendingOwner(newOwner)` and the new
    ///         owner calls `acceptOwner()` to take the ownership.
    function setPendingOwner(address to) external onlyOwner {
        pendingOwner = to;
        emit PendingOwnerSet(pendingOwner);
    }

    function acceptOwner() external {
        require(msg.sender == pendingOwner);
        _setOwner(pendingOwner);
    }

    /// @notice Make the contract immutable.
    function renounceOwnership() external onlyOwner {
        _setOwner(address(0));
    }

    /// @notice Rescue and transfer assets locked in this contract.
    function rescue(address token, address to) external onlyOwner {
        if (token == address(0)) {
            (bool success, ) = payable(to).call{value: address(this).balance}("");
            require(success, "ETH transfer failed");
        } else {
            IERC20(token).safeTransfer(to, IERC20(token).balanceOf(address(this)));
        }
    }

    // Internal functions

    /// @dev Clear pendingOwner to prevent from reclaiming the ownership.
    function _setOwner(address _owner) internal {
        owner = _owner;
        pendingOwner = address(0);
        emit NewOwnerSet(owner);
    }
}

File 8 of 21 : Errors.sol
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.19;

/// @dev Common errors. This helps reducing the contract size.
library Errors {
    // "E1";

    // Call/Static-call failed.
    string constant CALL_FAILED = "E2";

    // Argument's type not supported in View Variant.
    string constant INVALID_VIEW_ARG_SOL_TYPE = "E3";

    // Invalid length for variant raw data.
    string constant INVALID_VARIANT_RAW_DATA = "E4";

    // "E5";

    // Invalid variant type.
    string constant INVALID_VAR_TYPE = "E6";

    // Rule not exists
    string constant RULE_NOT_EXISTS = "E7";

    // Variant name not found.
    string constant VAR_NAME_NOT_FOUND = "E8";

    // Rule: v1/v2 solType mismatch
    string constant SOL_TYPE_MISMATCH = "E9";

    // "E10";

    // Invalid rule OP.
    string constant INVALID_RULE_OP = "E11";

    //  "E12";

    // "E13";

    //  "E14";

    // "E15";

    // "E16";

    // "E17";

    // "E18";

    // "E19";

    // "E20";

    // checkCmpOp: OP not support
    string constant CMP_OP_NOT_SUPPORT = "E21";

    // checkBySolType: Invalid op for bool
    string constant INVALID_BOOL_OP = "E22";

    // checkBySolType: Invalid op
    string constant CHECK_INVALID_OP = "E23";

    // Invalid solidity type.
    string constant INVALID_SOL_TYPE = "E24";

    // computeBySolType: invalid vm op
    string constant INVALID_VM_BOOL_OP = "E25";

    // computeBySolType: invalid vm arith op
    string constant INVALID_VM_ARITH_OP = "E26";

    // onlyCaller: Invalid caller
    string constant INVALID_CALLER = "E27";

    // "E28";

    // Side-effect is not allowed here.
    string constant SIDE_EFFECT_NOT_ALLOWED = "E29";

    // Invalid variant count for the rule op.
    string constant INVALID_VAR_COUNT = "E30";

    // extractCallData: Invalid op.
    string constant INVALID_EXTRACTOR_OP = "E31";

    // extractCallData: Invalid array index.
    string constant INVALID_ARRAY_INDEX = "E32";

    // extractCallData: No extract op.
    string constant NO_EXTRACT_OP = "E33";

    // extractCallData: No extract path.
    string constant NO_EXTRACT_PATH = "E34";

    // BaseOwnable: caller is not owner
    string constant CALLER_IS_NOT_OWNER = "E35";

    // BaseOwnable: Already initialized
    string constant ALREADY_INITIALIZED = "E36";

    // "E37";

    // "E38";

    // BaseACL: ACL check method should not return anything.
    string constant ACL_FUNC_RETURNS_NON_EMPTY = "E39";

    // "E40";

    // BaseAccount: Invalid delegate.
    string constant INVALID_DELEGATE = "E41";

    // RootAuthorizer: delegateCallAuthorizer not set
    string constant DELEGATE_CALL_AUTH_NOT_SET = "E42";

    // RootAuthorizer: callAuthorizer not set.
    string constant CALL_AUTH_NOT_SET = "E43";

    // BaseAccount: Authorizer not set.
    string constant AUTHORIZER_NOT_SET = "E44";

    // BaseAccount: Invalid authorizer flag.
    string constant INVALID_AUTHORIZER_FLAG = "E45";

    // BaseAuthorizer: Authorizer paused.
    string constant AUTHORIZER_PAUSED = "E46";

    // Authorizer set: Invalid hint.
    string constant INVALID_HINT = "E47";

    // Authorizer set: All auth deny.
    string constant ALL_AUTH_FAILED = "E48";

    // BaseACL: Method not allow.
    string constant METHOD_NOT_ALLOW = "E49";

    // AuthorizerUnionSet: Invalid hint collected.
    string constant INVALID_HINT_COLLECTED = "E50";

    // AuthorizerSet: Empty auth set
    string constant EMPTY_AUTH_SET = "E51";

    // AuthorizerSet: hint not implement.
    string constant HINT_NOT_IMPLEMENT = "E52";

    // RoleAuthorizer: Empty role set
    string constant EMPTY_ROLE_SET = "E53";

    // RoleAuthorizer: No auth for the role
    string constant NO_AUTH_FOR_THE_ROLE = "E54";

    // BaseACL: No in contract white list.
    string constant NOT_IN_CONTRACT_LIST = "E55";

    // BaseACL: Same process not allowed to install twice.
    string constant SAME_PROCESS_TWICE = "E56";

    // BaseAuthorizer: Account not set (then can not find roleManger)
    string constant ACCOUNT_NOT_SET = "E57";

    // BaseAuthorizer: roleManger not set
    string constant ROLE_MANAGER_NOT_SET = "E58";
}

// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.19;

import "../contracts/Types.sol";

interface IAuthorizer {
    function flag() external view returns (uint256 authFlags);

    function preExecCheck(TransactionData calldata transaction) external returns (AuthorizerReturnData memory authData);

    function postExecCheck(
        TransactionData calldata transaction,
        TransactionResult calldata callResult,
        AuthorizerReturnData calldata preAuthData
    ) external returns (AuthorizerReturnData memory authData);

    function preExecProcess(TransactionData calldata transaction) external;

    function postExecProcess(TransactionData calldata transaction, TransactionResult calldata callResult) external;
}

interface IAuthorizerSupportingHint is IAuthorizer {
    // When IAuthorizer(auth).flag().supportHint() == true;
    function collectHint(
        AuthorizerReturnData calldata preAuthData,
        AuthorizerReturnData calldata postAuthData
    ) external view returns (bytes memory hint);
}

// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.19;

import "../contracts/Types.sol";

interface IAccount {
    function execTransaction(CallData calldata callData) external returns (TransactionResult memory result);

    function execTransactions(
        CallData[] calldata callDataList
    ) external returns (TransactionResult[] memory resultList);

    function setAuthorizer(address _authorizer) external;

    function setRoleManager(address _roleManager) external;

    function addDelegate(address _delegate) external;

    function addDelegates(address[] calldata _delegates) external;

    /// @dev Sub instance should override this to set `from` for transaction
    /// @return account The address for the contract wallet, also the
    ///         `msg.sender` address which send the transaction.
    function getAccountAddress() external view returns (address account);

    function roleManager() external view returns (address _roleManager);

    function authorizer() external view returns (address _authorizer);
}

// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.19;

import "../contracts/Types.sol";

interface IRoleManager {
    function getRoles(address delegate) external view returns (bytes32[] memory);

    function hasRole(address delegate, bytes32 role) external view returns (bool);
}

interface IFlatRoleManager is IRoleManager {
    function addRoles(bytes32[] calldata roles) external;

    function grantRoles(bytes32[] calldata roles, address[] calldata delegates) external;

    function revokeRoles(bytes32[] calldata roles, address[] calldata delegates) external;

    function getDelegates() external view returns (address[] memory);

    function getAllRoles() external view returns (bytes32[] memory);
}

// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity >=0.8.17 <0.9.0;

// Ref: https://github.com/gnosisguild/zodiac-modifier-roles/blob/main/packages/evm/contracts/WriteOnce.sol
interface ICoboFactory {
    enum DeployType {
        Create2,
        Create3,
        Create2WithSender,
        Create3WithSender,
        Create2AndEmit,
        Create3AndEmit,
        Create2WithSenderAndEmit,
        Create3WithSenderAndEmit
    }

    function deploy(DeployType typ, bytes32 salt, bytes memory initCode) external returns (address);

    function getAddress(
        DeployType typ,
        bytes32 salt,
        address sender,
        bytes calldata initCode
    ) external view returns (address _contract);
}

library WriteOnce {
    address public constant COBO_FACTORY = 0xC0B000003148E9c3E0D314f3dB327Ef03ADF8Ba7;

    bytes32 public constant SALT = 0xc0b0000000000000000000000000000000000000000000000000000000000000;

    /**
    @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 == ICoboFactory(COBO_FACTORY).deploy(ICoboFactory.DeployType.Create2, SALT, creationBytecode)
            );
        }
    }

    /**
    @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 getPointer(bytes memory data) internal view returns (address pointer) {
        bytes memory creationBytecode = creationBytecodeFor(data);
        pointer = addressFor(creationBytecode);
    }

    function addressFor(bytes memory creationBytecode) private view returns (address) {
        return
            ICoboFactory(COBO_FACTORY).getAddress(ICoboFactory.DeployType.Create2, SALT, address(0), creationBytecode);
    }

    /**
    @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
            );
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}

File 14 of 21 : BaseVersion.sol
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.19;

import "../../interfaces/IVersion.sol";

/// @title BaseVersion - Provides version information
/// @author Cobo Safe Dev Team https://www.cobo.com/
/// @dev
///    Implement NAME() and VERSION() methods according to IVersion interface.
///
///    Or just:
///      bytes32 public constant NAME = "<Your contract name>";
///      uint256 public constant VERSION = <Your contract version>;
///
///    Change the NAME when writing new kind of contract.
///    Change the VERSION when upgrading existing contract.
abstract contract BaseVersion is IVersion {
    /// @dev Convert to `string` which looks prettier on Etherscan viewer.
    function _NAME() external view virtual returns (string memory) {
        return string(abi.encodePacked(this.NAME()));
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.19;

struct CallData {
    uint256 flag; // 0x1 delegate call, 0x0 call.
    address to;
    uint256 value;
    bytes data; // calldata
    bytes hint;
    bytes extra; // for future support: signatures etc.
}

struct TransactionData {
    address from; // `msg.sender` who performs the transaction a.k.a wallet address.
    address delegate; // Delegate who calls executeTransactions().
    // Same as CallData
    uint256 flag; // 0x1 delegate call, 0x0 call.
    address to;
    uint256 value;
    bytes data; // calldata
    bytes hint;
    bytes extra;
}

/// @dev Use enum instead of bool in case of when other status, like PENDING,
///      is needed in the future.
enum AuthResult {
    FAILED,
    SUCCESS
}

struct AuthorizerReturnData {
    AuthResult result;
    string message;
    bytes data; // Authorizer return data. usually used for hint purpose.
}

struct TransactionResult {
    bool success; // Call status.
    bytes data; // Return/Revert data.
    bytes hint;
}

library TxFlags {
    uint256 internal constant DELEGATE_CALL_MASK = 0x1; // 1 for delegatecall, 0 for call
    uint256 internal constant ALLOW_REVERT_MASK = 0x2; // 1 for allow, 0 for not

    function isDelegateCall(uint256 flag) internal pure returns (bool) {
        return flag & DELEGATE_CALL_MASK > 0;
    }

    function allowsRevert(uint256 flag) internal pure returns (bool) {
        return flag & ALLOW_REVERT_MASK > 0;
    }
}

library AuthType {
    bytes32 internal constant FUNC = "FunctionType";
    bytes32 internal constant ADDRESS = "AddressType";
    bytes32 internal constant RATE = "RateType";
    bytes32 internal constant TRANSFER = "TransferType";
    bytes32 internal constant APPROVE = "ApproveType";
    bytes32 internal constant REVOKE = "RevokeType";
    bytes32 internal constant DEX = "DexType";
    bytes32 internal constant LENDING = "LendingType";
    bytes32 internal constant COMMON = "CommonType";
    bytes32 internal constant SET = "SetType";
    bytes32 internal constant VM = "VM";
    bytes32 internal constant PERMISSION = "Permission";
}

library AuthFlags {
    uint256 internal constant HAS_PRE_CHECK_MASK = 0x1;
    uint256 internal constant HAS_POST_CHECK_MASK = 0x2;
    uint256 internal constant HAS_PRE_PROC_MASK = 0x4;
    uint256 internal constant HAS_POST_PROC_MASK = 0x8;

    uint256 internal constant STATIC_AUTH_MASK = 0x10;
    uint256 internal constant IMMUTABLE_MASK = 0x20;

    uint256 internal constant SUPPORT_HINT_MASK = 0x40;

    uint256 internal constant FULL_MODE =
        HAS_PRE_CHECK_MASK | HAS_POST_CHECK_MASK | HAS_PRE_PROC_MASK | HAS_POST_PROC_MASK;

    uint256 internal constant SIMPLE_MODE = HAS_PRE_CHECK_MASK | STATIC_AUTH_MASK;
    uint256 internal constant SIMPLE_IMMUTABLE_MODE = SIMPLE_MODE | IMMUTABLE_MASK;

    function isValid(uint256 flag) internal pure returns (bool) {
        // At least one check handler is activated.
        return hasPreCheck(flag) || hasPostCheck(flag);
    }

    function hasPreCheck(uint256 flag) internal pure returns (bool) {
        return flag & HAS_PRE_CHECK_MASK > 0;
    }

    function hasPostCheck(uint256 flag) internal pure returns (bool) {
        return flag & HAS_POST_CHECK_MASK > 0;
    }

    function hasPreProcess(uint256 flag) internal pure returns (bool) {
        return flag & HAS_PRE_PROC_MASK > 0;
    }

    function hasPostProcess(uint256 flag) internal pure returns (bool) {
        return flag & HAS_POST_PROC_MASK > 0;
    }

    function supportHint(uint256 flag) internal pure returns (bool) {
        return flag & SUPPORT_HINT_MASK > 0;
    }

    function isStatic(uint256 flag) internal pure returns (bool) {
        return flag & STATIC_AUTH_MASK > 0;
    }

    function isImmutable(uint256 flag) internal pure returns (bool) {
        return flag & IMMUTABLE_MASK > 0;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
        }
    }
}

// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.19;

interface IVersion {
    function NAME() external view returns (bytes32 name);

    function VERSION() external view returns (uint256 version);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

Settings
{
  "remappings": [
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "viaIR": true,
  "libraries": {}
}

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_caller","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"}],"name":"NewOwnerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"PendingOwnerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"id","type":"address"}],"name":"RuleAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"id","type":"address"}],"name":"RuleRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"tag","type":"bytes32"}],"name":"TagSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"name","type":"bytes32"}],"name":"VariableAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"name","type":"bytes32"}],"name":"VariableRemoved","type":"event"},{"inputs":[],"name":"NAME","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TYPE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_NAME","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"uint256","name":"flag","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Expression[]","name":"exprs","type":"tuple[]"}],"internalType":"struct Rule","name":"rule","type":"tuple"}],"name":"addRule","outputs":[{"internalType":"address","name":"id","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"name","type":"bytes32"},{"components":[{"internalType":"uint256","name":"flag","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Expression","name":"expr","type":"tuple"}],"name":"addVariable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"delegate","type":"address"},{"internalType":"uint256","name":"flag","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes","name":"hint","type":"bytes"},{"internalType":"bytes","name":"extra","type":"bytes"}],"internalType":"struct TransactionData","name":"transaction","type":"tuple"},{"components":[{"internalType":"uint256","name":"flag","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Expression","name":"expr","type":"tuple"}],"name":"evalBoolExpr","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"delegate","type":"address"},{"internalType":"uint256","name":"flag","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes","name":"hint","type":"bytes"},{"internalType":"bytes","name":"extra","type":"bytes"}],"internalType":"struct TransactionData","name":"transaction","type":"tuple"},{"internalType":"bytes32","name":"name","type":"bytes32"}],"name":"evalRef","outputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"flag","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"delegate","type":"address"},{"internalType":"uint256","name":"flag","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes","name":"hint","type":"bytes"},{"internalType":"bytes","name":"extra","type":"bytes"}],"internalType":"struct TransactionData","name":"transaction","type":"tuple"},{"components":[{"internalType":"uint256","name":"flag","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Expression","name":"expr","type":"tuple"}],"name":"getRawData","outputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"name","type":"bytes32"},{"components":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"delegate","type":"address"},{"internalType":"uint256","name":"flag","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes","name":"hint","type":"bytes"},{"internalType":"bytes","name":"extra","type":"bytes"}],"internalType":"struct TransactionData","name":"transaction","type":"tuple"}],"name":"getReservedNamedValue","outputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"id","type":"address"}],"name":"getRule","outputs":[{"components":[{"components":[{"internalType":"uint256","name":"flag","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Expression[]","name":"exprs","type":"tuple[]"}],"internalType":"struct Rule","name":"rule","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"delegate","type":"address"},{"internalType":"uint256","name":"flag","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes","name":"hint","type":"bytes"},{"internalType":"bytes","name":"extra","type":"bytes"}],"internalType":"struct TransactionData","name":"transaction","type":"tuple"}],"name":"getRuleHint","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"}],"name":"getRules","outputs":[{"components":[{"components":[{"internalType":"uint256","name":"flag","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Expression[]","name":"exprs","type":"tuple[]"}],"internalType":"struct Rule[]","name":"ret","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRulesCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"name","type":"bytes32"}],"name":"getVariable","outputs":[{"components":[{"internalType":"uint256","name":"flag","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Expression","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVariablesCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"id","type":"address"}],"name":"hasRule","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"name","type":"bytes32"}],"name":"hasVariable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_caller","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_caller","type":"address"},{"internalType":"address","name":"_account","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"delegate","type":"address"},{"internalType":"uint256","name":"flag","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes","name":"hint","type":"bytes"},{"internalType":"bytes","name":"extra","type":"bytes"}],"internalType":"struct TransactionData","name":"transaction","type":"tuple"},{"components":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes","name":"hint","type":"bytes"}],"internalType":"struct TransactionResult","name":"callResult","type":"tuple"},{"components":[{"internalType":"enum AuthResult","name":"result","type":"uint8"},{"internalType":"string","name":"message","type":"string"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct AuthorizerReturnData","name":"preData","type":"tuple"}],"name":"postExecCheck","outputs":[{"components":[{"internalType":"enum AuthResult","name":"result","type":"uint8"},{"internalType":"string","name":"message","type":"string"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct AuthorizerReturnData","name":"authData","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"delegate","type":"address"},{"internalType":"uint256","name":"flag","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes","name":"hint","type":"bytes"},{"internalType":"bytes","name":"extra","type":"bytes"}],"internalType":"struct TransactionData","name":"transaction","type":"tuple"},{"components":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes","name":"hint","type":"bytes"}],"internalType":"struct TransactionResult","name":"callResult","type":"tuple"}],"name":"postExecProcess","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"delegate","type":"address"},{"internalType":"uint256","name":"flag","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes","name":"hint","type":"bytes"},{"internalType":"bytes","name":"extra","type":"bytes"}],"internalType":"struct TransactionData","name":"transaction","type":"tuple"}],"name":"preExecCheck","outputs":[{"components":[{"internalType":"enum AuthResult","name":"result","type":"uint8"},{"internalType":"string","name":"message","type":"string"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct AuthorizerReturnData","name":"authData","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"delegate","type":"address"},{"internalType":"uint256","name":"flag","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes","name":"hint","type":"bytes"},{"internalType":"bytes","name":"extra","type":"bytes"}],"internalType":"struct TransactionData","name":"transaction","type":"tuple"}],"name":"preExecProcess","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"id","type":"address"}],"name":"removeRule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"uint256","name":"flag","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Expression[]","name":"exprs","type":"tuple[]"}],"internalType":"struct Rule","name":"rule","type":"tuple"}],"name":"removeRule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"name","type":"bytes32"}],"name":"removeVariable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"rescue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"delegate","type":"address"},{"internalType":"uint256","name":"flag","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes","name":"hint","type":"bytes"},{"internalType":"bytes","name":"extra","type":"bytes"}],"internalType":"struct TransactionData","name":"transaction","type":"tuple"},{"internalType":"address","name":"id","type":"address"}],"name":"runRule","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"setPendingOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_tag","type":"bytes32"}],"name":"setTag","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tag","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
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.