false
false
0
The new Blockscout UI is now open source! Learn how to deploy it here
- We're indexing this chain right now. Some of the counts may be inaccurate.

Contract Address Details

0x9f5b097AD23e2CF4F34e502A3E41D941678877Dc

Contract Name
GasVault
Creator
0x077675–fb67cc at 0x4518be–65ad13
Balance
0 ETH
Tokens
Fetching tokens...
Transactions
Fetching transactions...
Transfers
Fetching transfers...
Gas Used
Fetching gas used...
Last Balance Update
725695
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
GasVault




Optimization enabled
true
Compiler version
v0.8.12+commit.f00d7308




Optimization runs
10
EVM Version
london




Verified at
2024-06-07T13:14:53.937172Z

contracts/GasVault.sol

// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.8.12;

import "./interfaces/IGasVault.sol";
import "./interfaces/IOrchestrator.sol";
import "./interfaces/IStrategyRegistry.sol";
import "./interfaces/IVaultRegistry.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";

/**
 * @dev vault for storing gas for each strategy. Nodes must still pay gas cost to call, but execution costs
 *  will come out of the gas account.
 */
contract GasVault is
    IGasVault,
    Initializable,
    OwnableUpgradeable,
    UUPSUpgradeable,
    ReentrancyGuardUpgradeable
{
    // Storage

    IOrchestrator public orchestrator;
    IStrategyRegistry public strategyRegistry;
    IVaultRegistry public vaultRegistry;

    /// @notice Mapping from vault address to gasInfo
    mapping(address => uint256) public ethBalances;

    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() initializer() {}

    /// @dev Permanently sets related addresses
    /// @param _orchestrator Address of the orchestrator contract
    /// @param _stratRegistry Address of the strategy registry contract
    /// @param _vaultRegistry Address of the vault registry contract
    function initialize(
        address _orchestrator,
        address _stratRegistry,
        address _vaultRegistry
    ) public initializer {
        __Ownable_init();
        __UUPSUpgradeable_init();
        __ReentrancyGuard_init();
        require(_orchestrator != address(0), "address(0)");
        require(_stratRegistry != address(0), "address(0)");
        require(_vaultRegistry != address(0), "address(0)");
        orchestrator = IOrchestrator(_orchestrator);
        strategyRegistry = IStrategyRegistry(_stratRegistry);
        vaultRegistry = IVaultRegistry(_vaultRegistry);
    }

    function _authorizeUpgrade(address) internal override onlyOwner {}

    modifier onlyOrchestrator() {
        require(
            msg.sender == address(orchestrator),
            "Only orchestrator can call this"
        );
        _;
    }

    /// @dev Deposit more eth to be used in jobs.
    ///      Can only be withdrawn by governance and the given vault,
    ///      so in most cases these funds are unretrievable.
    /// @param targetAddress address of the recipient of these gas funds
    function deposit(address targetAddress) external payable override {
        ethBalances[targetAddress] += msg.value;
        emit Deposited(msg.sender, targetAddress, msg.value);
    }

    /// @dev Normal withdraw function, normally used by keepers
    /// @param amount The amount to withdraw
    /// @param to Address to send the ether to
    function withdraw(
        uint256 amount,
        address payable to
    ) external override nonReentrant {
        ethBalances[msg.sender] -= amount;
        emit Withdrawn(msg.sender, to, amount);
        AddressUpgradeable.sendValue(to, amount);
    }

    /// @param targetAddress The address of the vault in question
    /// @param highGasEstimate An estimate of the highest reasonable gas price which
    ///                        a transaction will cost, in terms of wei.
    ///                        In other words, given a bad gas price,
    ///                        how many more times can a strategy be run.
    /// @return transactions Remaining, assuming upper limit estimate of gas price
    ///                      is used for the transaction
    function transactionsRemaining(
        address targetAddress,
        uint256 highGasEstimate
    ) external view override returns (uint256) {
        IVaultRegistry.VaultData memory vaultInfo = vaultRegistry
            .getVaultDetails(targetAddress);
        IStrategyRegistry.RegisteredStrategy memory info = strategyRegistry
            .getRegisteredStrategy(vaultInfo.tokenId);
        if (highGasEstimate > info.maxGasCost) {
            return 0;
        } else {
            uint256 totalWeiPerMethod = info.maxGasPerAction * highGasEstimate;
            return ethBalances[targetAddress] / totalWeiPerMethod;
        }
    }

    /// @dev Orchestrator calls this function in order to reimburse tx.origin for method gas.
    ///      First it checks that all parameters are correct (gas price isn't too high),
    ///      And then it returns as much gas as is available to use in the transaction.
    ///      Note that this function will revert if the gas price is too high for the strategy.
    ///      This should be checked by the keeper beforehand.
    /// @param _targetAddress Address actions will be performed on, and address paying gas for those actions.
    /// @return gasAvailable (representing amount of gas available per Method).
    function gasAvailableForTransaction(
        address _targetAddress
    ) external view returns (uint256) {
        // Get gas info
        IVaultRegistry.VaultData memory vaultInfo = vaultRegistry
            .getVaultDetails(_targetAddress);
        IStrategyRegistry.RegisteredStrategy memory info = strategyRegistry
            .getRegisteredStrategy(vaultInfo.tokenId);

        // Ensure requested gas use is acceptable.
        // wei / gas must be less than maxGasCost,
        // and GasVault must have enough ether allotted to pay for action.
        require(tx.gasprice <= info.maxGasCost, "Gas too expensive.");

        // Represents gas available per action. Gas cost of all methods must be <= this.
        uint256 gasAvailable = info.maxGasPerAction;
        require(
            ethBalances[_targetAddress] >= tx.gasprice * gasAvailable,
            "Insufficient ether deposited"
        );

        // Return gas available
        return gasAvailable;
    }

    /// @dev Note that keepers still have to pull their gas from the GasVault in order
    ///      to truly be reimbursed--until then the ETH is just sitting in the GasVault.
    /// @param targetAddress The address which the action was performed upon.
    ///                      The reimbursement will come from its gas fund.
    /// @param originalGas How much gas there was at the start of the action (before any action was called)
    /// @param jobHash The hash of the job which was performed.
    ///                All vaults other than DynamicJobs can only have one job,
    ///                so in this case jobHash will just be actionHash.
    function reimburseGas(
        address targetAddress,
        uint256 originalGas,
        bytes32 jobHash
    ) external onlyOrchestrator {
        // Calculate reimbursement amount
        uint256 gasUsed = originalGas - gasleft();
        uint256 ethUsed = (gasUsed * tx.gasprice);

        // Distribute funds
        ethBalances[targetAddress] -= ethUsed;
        unchecked {
            ethBalances[tx.origin] += ethUsed;
        }
        emit EtherUsed(targetAddress, ethUsed, jobHash);
    }
}
        

@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Context_init_unchained();
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
    uint256[49] private __gap;
}
          

@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Upgrade.sol)

pragma solidity ^0.8.2;

import "../beacon/IBeaconUpgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/StorageSlotUpgradeable.sol";
import "../utils/Initializable.sol";

/**
 * @dev This abstract contract provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
 *
 * _Available since v4.1._
 *
 * @custom:oz-upgrades-unsafe-allow delegatecall
 */
abstract contract ERC1967UpgradeUpgradeable is Initializable {
    function __ERC1967Upgrade_init() internal onlyInitializing {
        __ERC1967Upgrade_init_unchained();
    }

    function __ERC1967Upgrade_init_unchained() internal onlyInitializing {
    }
    // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
    bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;

    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Returns the current implementation address.
     */
    function _getImplementation() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract");
        StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
    }

    /**
     * @dev Perform implementation upgrade
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeTo(address newImplementation) internal {
        _setImplementation(newImplementation);
        emit Upgraded(newImplementation);
    }

    /**
     * @dev Perform implementation upgrade with additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCall(
        address newImplementation,
        bytes memory data,
        bool forceCall
    ) internal {
        _upgradeTo(newImplementation);
        if (data.length > 0 || forceCall) {
            _functionDelegateCall(newImplementation, data);
        }
    }

    /**
     * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCallSecure(
        address newImplementation,
        bytes memory data,
        bool forceCall
    ) internal {
        address oldImplementation = _getImplementation();

        // Initial upgrade and setup call
        _setImplementation(newImplementation);
        if (data.length > 0 || forceCall) {
            _functionDelegateCall(newImplementation, data);
        }

        // Perform rollback test if not already in progress
        StorageSlotUpgradeable.BooleanSlot storage rollbackTesting = StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT);
        if (!rollbackTesting.value) {
            // Trigger rollback using upgradeTo from the new implementation
            rollbackTesting.value = true;
            _functionDelegateCall(
                newImplementation,
                abi.encodeWithSignature("upgradeTo(address)", oldImplementation)
            );
            rollbackTesting.value = false;
            // Check rollback was effective
            require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades");
            // Finally reset to the new implementation and log the upgrade
            _upgradeTo(newImplementation);
        }
    }

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Emitted when the admin account has changed.
     */
    event AdminChanged(address previousAdmin, address newAdmin);

    /**
     * @dev Returns the current admin.
     */
    function _getAdmin() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        require(newAdmin != address(0), "ERC1967: new admin is the zero address");
        StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
    }

    /**
     * @dev Changes the admin of the proxy.
     *
     * Emits an {AdminChanged} event.
     */
    function _changeAdmin(address newAdmin) internal {
        emit AdminChanged(_getAdmin(), newAdmin);
        _setAdmin(newAdmin);
    }

    /**
     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
     * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.
     */
    bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;

    /**
     * @dev Emitted when the beacon is upgraded.
     */
    event BeaconUpgraded(address indexed beacon);

    /**
     * @dev Returns the current beacon.
     */
    function _getBeacon() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;
    }

    /**
     * @dev Stores a new beacon in the EIP1967 beacon slot.
     */
    function _setBeacon(address newBeacon) private {
        require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract");
        require(
            AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),
            "ERC1967: beacon implementation is not a contract"
        );
        StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;
    }

    /**
     * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
     * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
     *
     * Emits a {BeaconUpgraded} event.
     */
    function _upgradeBeaconToAndCall(
        address newBeacon,
        bytes memory data,
        bool forceCall
    ) internal {
        _setBeacon(newBeacon);
        emit BeaconUpgraded(newBeacon);
        if (data.length > 0 || forceCall) {
            _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);
        }
    }

    /**
     * @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) private returns (bytes memory) {
        require(AddressUpgradeable.isContract(target), "Address: delegate call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return AddressUpgradeable.verifyCallResult(success, returndata, "Address: low-level delegate call failed");
    }
    uint256[50] private __gap;
}
          

@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)

pragma solidity ^0.8.0;

/**
 * @dev This is the interface that {BeaconProxy} expects of its beacon.
 */
interface IBeaconUpgradeable {
    /**
     * @dev Must return an address that can be used as a delegate call target.
     *
     * {BeaconProxy} will check that this address is a contract.
     */
    function implementation() external view returns (address);
}
          

@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol)

pragma solidity ^0.8.0;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the
 * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() initializer {}
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
        // contract may have been reentered.
        require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} modifier, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}
          

@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/utils/UUPSUpgradeable.sol)

pragma solidity ^0.8.0;

import "../ERC1967/ERC1967UpgradeUpgradeable.sol";
import "./Initializable.sol";

/**
 * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
 * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
 *
 * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
 * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
 * `UUPSUpgradeable` with a custom implementation of upgrades.
 *
 * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
 *
 * _Available since v4.1._
 */
abstract contract UUPSUpgradeable is Initializable, ERC1967UpgradeUpgradeable {
    function __UUPSUpgradeable_init() internal onlyInitializing {
        __ERC1967Upgrade_init_unchained();
        __UUPSUpgradeable_init_unchained();
    }

    function __UUPSUpgradeable_init_unchained() internal onlyInitializing {
    }
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
    address private immutable __self = address(this);

    /**
     * @dev Check that the execution is being performed through a delegatecall call and that the execution context is
     * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case
     * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
     * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
     * fail.
     */
    modifier onlyProxy() {
        require(address(this) != __self, "Function must be called through delegatecall");
        require(_getImplementation() == __self, "Function must be called through active proxy");
        _;
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     */
    function upgradeTo(address newImplementation) external virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallSecure(newImplementation, new bytes(0), false);
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
     * encoded in `data`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallSecure(newImplementation, data, true);
    }

    /**
     * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
     * {upgradeTo} and {upgradeToAndCall}.
     *
     * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
     *
     * ```solidity
     * function _authorizeUpgrade(address) internal override onlyOwner {}
     * ```
     */
    function _authorizeUpgrade(address newImplementation) internal virtual;
    uint256[50] private __gap;
}
          

@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuardUpgradeable is Initializable {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
    uint256[49] private __gap;
}
          

@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165Upgradeable.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721Upgradeable is IERC165Upgradeable {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;
}
          

@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../IERC721Upgradeable.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721EnumerableUpgradeable is IERC721Upgradeable {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}
          

@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol

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

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 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 functionCall(target, data, "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");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason 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 {
            // 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
          

@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
        __Context_init_unchained();
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
    uint256[50] private __gap;
}
          

@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._
 */
library StorageSlotUpgradeable {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        assembly {
            r.slot := slot
        }
    }
}
          

@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165Upgradeable {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
          

contracts/interfaces/IGasVault.sol

// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.8.12;

interface IGasVault {
    event Deposited(
        address indexed origin,
        address indexed target,
        uint256 amount
    );
    event Withdrawn(
        address indexed targetAddress,
        address indexed to,
        uint256 amount
    );
    event EtherUsed(address indexed account, uint256 amount, bytes32 jobHash);

    function deposit(address targetAddress) external payable;

    function withdraw(uint256 amount, address payable to) external;

    /**
     * @dev calculates total transactions remaining. What this means is--assuming that each method (action paid for by the strategist/job owner)
     *      costs max amount of gas at max gas price, and uses the max amount of actions, how many transactions can be paid for?
     *      In other words, how many actions can this vault guarantee.
     * @param targetAddress is address actions will be performed on, and address paying gas for those actions.
     * @param highGasEstimate is highest reasonable gas price assumed for the actions
     * @return total transactions remaining, assuming max gas is used in each Method
     */
    function transactionsRemaining(
        address targetAddress,
        uint256 highGasEstimate
    ) external view returns (uint256);

    /**
     * @param targetAddress is address actions will be performed on, and address paying gas for those actions.
     * @return uint256 gasAvailable (representing amount of gas available per Method).
     */
    function gasAvailableForTransaction(
        address targetAddress
    ) external view returns (uint256);

    /**
     * @param targetAddress is address actions were performed on
     * @param originalGas is gas passed in to the action execution order. Used to calculate gas used in the execution.
     * @dev should only ever be called by the orchestrator. Is onlyOrchestrator. This and setAsideGas are used to pull gas from the vault for strategy executions.
     */
    function reimburseGas(
        address targetAddress,
        uint256 originalGas,
        bytes32 newActionHash
    ) external;
}
          

contracts/interfaces/IOrchestrator.sol

// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.8.12;

/**
 * @dev Interface of the Orchestrator.
 */
interface IOrchestrator {
    enum ActionState {
        PENDING,
        COMPLETED
    }

    /**
     * @dev MUST trigger when actions are executed.
     * @param actionHash: keccak256(targetAddress, jobEpoch, calldatas) used to identify this action
     * @param from: the address of the keeper that executed this action
     * @param rewardPerAction: SteerToken reward for this action, to be supplied to operator nodes.
     */
    event ActionExecuted(
        bytes32 indexed actionHash,
        address from,
        uint256 rewardPerAction
    );
    event ActionFailed(bytes32 indexed actionHash);
    event Vote(
        bytes32 indexed actionHash,
        address indexed from,
        bool approved
    );

    // If an action is approved by >= approvalThresholdPercent members, it is approved
    function actionThresholdPercent() external view returns (uint256);

    // Address of GasVault, which is the contract used to recompense keepers for gas they spent executing actions
    function gasVault() external view returns (address);

    // Address of Keeper Registry, which handles keeper verification
    function keeperRegistry() external view returns (address);

    // Operator node action participation reward. Currently unused.
    function rewardPerAction() external view returns (uint256);

    /*
        bytes32 is hash of action. Calculated using keccak256(abi.encode(targetAddress, jobEpoch, calldatas))

        Action approval meaning:
        0: Pending
        1: Approved
        Both votes and overall approval status follow this standard.
    */
    function actions(bytes32) external view returns (ActionState);

    /*  
        actionHash => uint256 where each bit represents one keeper vote.
    */
    function voteBitmaps(bytes32) external view returns (uint256);

    /**
     * @dev initialize the Orchestrator
     * @param _keeperRegistry address of the keeper registry
     * @param _rewardPerAction is # of SteerToken to give to operator nodes for each completed action (currently unused)
     */
    function initialize(address _keeperRegistry, uint256 _rewardPerAction)
        external;

    /**
     * @dev allows owner to set/update gas vault address. Mainly used to resolve mutual dependency.
     */
    function setGasVault(address _gasVault) external;

    /**
     * @dev set the reward given to operator nodes for their participation in a strategy calculation
     * @param _rewardPerAction is amount of steer token to be earned as a reward, per participating operator node per action.
     */
    function setRewardPerAction(uint256 _rewardPerAction) external;

    /**
     * @dev vote (if you are a keeper) on a given action proposal
     * @param actionHash is the hash of the action to be voted on
     * @param vote is the vote to be cast. false: reject, true: approve. false only has an effect if the keeper previously voted true. It resets their vote to false.
     */
    function voteOnAction(bytes32 actionHash, bool vote) external;

    /**
     * @dev Returns true if an action with given `actionId` is approved by all existing members of the group.
     * It’s up to the contract creators to decide if this method should look at majority votes (based on ownership)
     * or if it should ask consent of all the users irrespective of their ownerships.
     */
    function actionApprovalStatus(bytes32 actionHash)
        external
        view
        returns (bool);

    /**
     * @dev Executes the action referenced by the given `actionId` as long as it is approved actionThresholdPercent of group.
     * The executeAction executes all methods as part of given action in an atomic way (either all should succeed or none should succeed).
     * Once executed, the action should be set as executed (state=3) so that it cannot be executed again.

     * @param targetAddress is the address which will be receiving the action's calls.
     * @param jobEpoch is the job epoch of this action.
     * @param calldatas is the COMPLETE calldata of each method to be called
     * note that the hash is created using the sliced calldata, but here it must be complete or the method will revert.
     * @param timeIndependentLengths--For each calldata, the number of bytes that is NOT time-sensitive. If no calldatas are time-sensitive, just pass an empty array.
     * @param jobHash is the identifier for the job this action is related to. This is used for DynamicJobs to identify separate jobs to the subgraph.
     * @return actionState corresponding to post-execution action state. Pending if execution failed, Completed if execution succeeded.
     */
    function executeAction(
        address targetAddress,
        uint256 jobEpoch,
        bytes[] calldata calldatas,
        uint256[] calldata timeIndependentLengths,
        bytes32 jobHash
    ) external returns (ActionState);
}
          

contracts/interfaces/IStrategyRegistry.sol

// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.12;
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol";

interface IStrategyRegistry is
    IERC721Upgradeable,
    IERC721EnumerableUpgradeable
{
    struct RegisteredStrategy {
        uint256 id;
        string name;
        address owner;
        string execBundle; //IPFS reference of execution bundle
        //GasVault stuff
        uint128 maxGasCost;
        uint128 maxGasPerAction;
    }

    function getStrategyAddress(uint256 tokenId)
        external
        view
        returns (address);

    function getStrategyOwner(uint256 tokenId) external view returns (address);

    /**
     * @dev Create NFT for execution bundle.
     * @param name The name of the strategy.
     * @param execBundle The IPFS reference of the execution bundle.
     * @return newStrategyTokenId The token ID of the NFT.
     */
    function createStrategy(
        address strategyCreator,
        string memory name,
        string memory execBundle,
        uint128 maxGasCost,
        uint128 maxGasPerAction
    ) external returns (uint256 newStrategyTokenId);

    //
    // Todo: add to utility library
    //
    function addressToString(address _address)
        external
        pure
        returns (string memory);

    /**
     * @dev Pauses all token transfers.
     *
     * See {ERC721Pausable} and {Pausable-_pause}.
     *
     * Requirements:
     *
     * - the caller must have the `PAUSER_ROLE`.
     */
    function pause() external;

    /**
     * @dev Unpauses all token transfers.
     *
     * See {ERC721Pausable} and {Pausable-_unpause}.
     *
     * Requirements:
     *
     * - the caller must have the `PAUSER_ROLE`.
     */
    function unpause() external;

    function tokenURI(uint256 tokenId) external view returns (string memory);

    function getRegisteredStrategy(uint256 tokenId)
        external
        view
        returns (IStrategyRegistry.RegisteredStrategy memory);

    /**
     * @dev parameters users set for what constitutes an acceptable use of their funds. Can only be set by NFT owner.
     * @param _tokenId is the token ID of the execution bundle.
     * @param _maxGasCost is highest acceptable price to pay per gas, in terms of gwei.
     * @param _maxGasPerMethod is max amount of gas to be sent in one method.
     * @param _maxMethods is the maximum number of methods that can be executed in one action.
     */
    function setGasParameters(
        uint256 _tokenId,
        uint128 _maxGasCost,
        uint128 _maxGasPerMethod,
        uint16 _maxMethods
    ) external;

    //function getExecutionBundle(uint256 tokenId) external view returns (string memory);

    function baseURI() external view returns (string memory);

    function burn(uint256 tokenId) external;

    function supportsInterface(bytes4 interfaceId)
        external
        view
        returns (bool);
}
          

contracts/interfaces/IVaultRegistry.sol

// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.12;
pragma abicoder v2; //Used this because function getAssetSymbols uses string[2]

import { IStrategyRegistry } from "./IStrategyRegistry.sol";
import { IOrchestrator } from "./IOrchestrator.sol";

interface IVaultRegistry {
    /**
     * PendingApproval: strategy is submitted but has not yet been approved by the owner
     * PendingThreshold: strategy is approved but has not yet reached the threshold of TVL required
     * Paused: strategy was active but something went wrong, so now it's paused
     * Active: strategy is active and can be used
     * Retired: strategy is retired and can no longer be used
     */
    enum VaultState {
        PendingApproval,
        PendingThreshold,
        Paused,
        Active,
        Retired
    }

    /**
     * @dev all necessary data for vault. Name and symbol are stored in vault's ERC20. Owner is stored with tokenId in StrategyRegistry.
     * tokenId: NFT identifier number
     * vaultAddress: address of vault this describes
     * state: state of the vault.
     */
    struct VaultData {
        VaultState state;
        uint256 tokenId; //NFT ownership of this vault and all others that use vault's exec bundle
        uint256 vaultID; //unique identifier for this vault and strategy token id
        string payloadIpfs;
        address vaultAddress;
        string beaconName;
    }

    /// @dev Vault creation event
    /// @param deployer The address of the deployer
    /// @param vault The address of the vault
    /// @param tokenId ERC721 token id for the vault
    /// @param vaultManager is the address which will manage the vault being created
    event VaultCreated(
        address deployer,
        address vault,
        string beaconName,
        uint256 indexed tokenId,
        address vaultManager
    );

    /// @dev Vault state change event
    /// @param vault The address of the vault
    /// @param newState The new state of the vault
    event VaultStateChanged(address indexed vault, VaultState newState);

    // Total vault count.
    function totalVaultCount() external view returns (uint256);

    function whitelistRegistry() external view returns (address);

    function orchestrator() external view returns (IOrchestrator);

    function beaconAddresses(string calldata) external view returns (address);

    function beaconTypes(address) external view returns (string memory);

    // Interface for the strategy registry
    function strategyRegistry() external view returns (IStrategyRegistry);

    /// @dev intializes the vault registry
    /// @param _orchestrator The address of the orchestrator
    /// @param _strategyRegistry The address of the strategy registry
    /// @param _whitelistRegistry The address of the whitelist registry
    function initialize(
        address _orchestrator,
        address _strategyRegistry,
        address _whitelistRegistry
    ) external;

    /// @dev Registers a beacon associated with a new vault type
    /// @param _name The name of the vault type this beacon will be using
    /// @param _address The address of the upgrade beacon
    /// @param _ipfsConfigForBeacon IPFS hash for the config of this beacon
    function registerBeacon(
        string calldata _name,
        address _address,
        string calldata _ipfsConfigForBeacon
    ) external;

    /// @dev Deploy new beacon for a new vault type AND register it
    /// @param _address The address of the implementation for the beacon
    /// @param _name The name of the beacon (identifier)
    /// @param _ipfsConfigForBeacon IPFS hash for the config of this beacon
    function deployAndRegisterBeacon(
        address _address,
        string calldata _name,
        string calldata _ipfsConfigForBeacon
    ) external returns (address);

    /// @dev Removes a beacon associated with a vault type
    /// @param _name The name of the beacon (identifier)
    /// @dev This will stop the creation of more vaults of the type provided
    function deregisterBeacon(string calldata _name) external;

    /// @dev Creates a new vault with the given strategy
    /// @dev Registers an execution bundle, mints an NFT and mappings it to execution bundle and it's details.
    /// @param _params is extra parameters in vault.
    /// @param _tokenId is the NFT of the execution bundle this vault will be using.
    /// @param _beaconName beacon identifier of vault type to be created
    /// @dev owner is set as msg.sender.
    function createVault(
        bytes memory _params,
        uint256 _tokenId,
        string memory _beaconName,
        address _vaultManager,
        string memory strategyData
    ) external returns (address);

    /// @dev Updates the vault state and emits a VaultStateChanged event
    /// @param _vault The address of the vault
    /// @param _newState The new state of the vault
    /// @dev This function is only available to the registry owner
    function updateVaultState(address _vault, VaultState _newState) external;

    /// @dev Retrieves the creator of a given vault
    /// @param _vault The address of the vault
    /// @return The address of the creator
    function getStrategyCreatorForVault(
        address _vault
    ) external view returns (address);

    /// @dev This function is only available to the pauser role
    function pause() external;

    function unpause() external;

    /// @dev Retrieves the details of a given vault by address
    /// @param _address The address of the vault
    /// @return The details of the vault
    function getVaultDetails(
        address _address
    ) external view returns (VaultData memory);

    /// @dev Retrieves the vault count by vault token id
    /// @param _tokenId The token id of the vault
    /// @return The count of the vault
    function getVaultCountByStrategyId(
        uint256 _tokenId
    ) external view returns (uint256);

    /// @dev Retrieves the vault by vault token id and vault index
    /// @param _tokenId The token id of the vault
    /// @param _vaultId The index of the vault
    /// @return Vault details
    function getVaultByStrategyAndIndex(
        uint256 _tokenId,
        uint256 _vaultId
    ) external view returns (VaultData memory);
}
          

Compiler Settings

{"outputSelection":{"*":{"*":["*"],"":["*"]}},"optimizer":{"runs":10,"enabled":true},"metadata":{"useLiteralContent":true,"bytecodeHash":"ipfs"},"libraries":{},"evmVersion":"london"}
              

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"event","name":"AdminChanged","inputs":[{"type":"address","name":"previousAdmin","internalType":"address","indexed":false},{"type":"address","name":"newAdmin","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"BeaconUpgraded","inputs":[{"type":"address","name":"beacon","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Deposited","inputs":[{"type":"address","name":"origin","internalType":"address","indexed":true},{"type":"address","name":"target","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"EtherUsed","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"bytes32","name":"jobHash","internalType":"bytes32","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Upgraded","inputs":[{"type":"address","name":"implementation","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Withdrawn","inputs":[{"type":"address","name":"targetAddress","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"payable","outputs":[],"name":"deposit","inputs":[{"type":"address","name":"targetAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"ethBalances","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"gasAvailableForTransaction","inputs":[{"type":"address","name":"_targetAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"_orchestrator","internalType":"address"},{"type":"address","name":"_stratRegistry","internalType":"address"},{"type":"address","name":"_vaultRegistry","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IOrchestrator"}],"name":"orchestrator","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"reimburseGas","inputs":[{"type":"address","name":"targetAddress","internalType":"address"},{"type":"uint256","name":"originalGas","internalType":"uint256"},{"type":"bytes32","name":"jobHash","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IStrategyRegistry"}],"name":"strategyRegistry","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"transactionsRemaining","inputs":[{"type":"address","name":"targetAddress","internalType":"address"},{"type":"uint256","name":"highGasEstimate","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"upgradeTo","inputs":[{"type":"address","name":"newImplementation","internalType":"address"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"upgradeToAndCall","inputs":[{"type":"address","name":"newImplementation","internalType":"address"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IVaultRegistry"}],"name":"vaultRegistry","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"address","name":"to","internalType":"address payable"}]}]
              

Contract Creation Code

0x60a0604052306080523480156200001557600080fd5b50600054610100900460ff16620000335760005460ff16156200003d565b6200003d620000e2565b620000a55760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b600054610100900460ff16158015620000c8576000805461ffff19166101011790555b8015620000db576000805461ff00191690555b5062000106565b6000620000fa306200010060201b62000c161760201c565b15905090565b3b151590565b608051611948620001376000396000818161037a015281816103ba01528181610443015261048301526119486000f3fe6080604052600436106100b75760003560e01c8062f714ce146100bc5780633659cfe6146100de5780633cfba0e3146100fe5780634f1ef2861461013e57806361d2be2e14610151578063715018a6146101715780638da5cb5b14610186578063b6e1b3e9146101a8578063b74795d9146101c8578063c0c53b8b146101e8578063cda08c1614610208578063cdd7b38a14610228578063d080bf2714610248578063f2fde38b14610268578063f340fa0114610288575b600080fd5b3480156100c857600080fd5b506100dc6100d7366004611250565b61029b565b005b3480156100ea57600080fd5b506100dc6100f9366004611280565b61036f565b34801561010a57600080fd5b5061012b610119366004611280565b60fe6020526000908152604090205481565b6040519081526020015b60405180910390f35b6100dc61014c366004611332565b610438565b34801561015d57600080fd5b5061012b61016c3660046113c4565b6104f2565b34801561017d57600080fd5b506100dc61065e565b34801561019257600080fd5b5061019b610699565b60405161013591906113f0565b3480156101b457600080fd5b506100dc6101c3366004611404565b6106a8565b3480156101d457600080fd5b5060fb5461019b906001600160a01b031681565b3480156101f457600080fd5b506100dc610203366004611439565b6107b0565b34801561021457600080fd5b5061012b610223366004611280565b610933565b34801561023457600080fd5b5060fd5461019b906001600160a01b031681565b34801561025457600080fd5b5060fc5461019b906001600160a01b031681565b34801561027457600080fd5b506100dc610283366004611280565b610b09565b6100dc610296366004611280565b610ba6565b600260c95414156102f35760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b600260c95533600090815260fe60205260408120805484929061031790849061149a565b90915550506040518281526001600160a01b0382169033907fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb9060200160405180910390a36103668183610c1c565b5050600160c955565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156103b85760405162461bcd60e51b81526004016102ea906114b1565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166103ea610d37565b6001600160a01b0316146104105760405162461bcd60e51b81526004016102ea906114eb565b61041981610d53565b6040805160008082526020820190925261043591839190610d82565b50565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156104815760405162461bcd60e51b81526004016102ea906114b1565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166104b3610d37565b6001600160a01b0316146104d95760405162461bcd60e51b81526004016102ea906114eb565b6104e282610d53565b6104ee82826001610d82565b5050565b60fd546040516367a44ca360e01b815260009182916001600160a01b03909116906367a44ca3906105279087906004016113f0565b600060405180830381865afa158015610544573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261056c91908101906115b5565b60fc54602082015160405163f1eb1a2b60e01b81529293506000926001600160a01b039092169163f1eb1a2b916105a99160040190815260200190565b600060405180830381865afa1580156105c6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526105ee9190810190611692565b905080608001516001600160801b031684111561061057600092505050610658565b6000848260a001516001600160801b031661062b919061175f565b6001600160a01b038716600090815260fe602052604090205490915061065290829061177e565b93505050505b92915050565b33610667610699565b6001600160a01b03161461068d5760405162461bcd60e51b81526004016102ea906117a0565b6106976000610ec9565b565b6033546001600160a01b031690565b60fb546001600160a01b031633146107025760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c79206f7263686573747261746f722063616e2063616c6c20746869730060448201526064016102ea565b60005a61070f908461149a565b9050600061071d3a8361175f565b6001600160a01b038616600090815260fe602052604081208054929350839290919061074a90849061149a565b909155505032600090815260fe602090815260409182902080548401905581518381529081018590526001600160a01b038716917f8df42119868c5e2a521d70014ce6857e311acdcf0669c555b17adf8bb53a313a910160405180910390a25050505050565b600054610100900460ff166107cb5760005460ff16156107cf565b303b155b6108325760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016102ea565b600054610100900460ff16158015610854576000805461ffff19166101011790555b61085c610f1b565b610864610f52565b61086c610f89565b6001600160a01b0384166108925760405162461bcd60e51b81526004016102ea906117d5565b6001600160a01b0383166108b85760405162461bcd60e51b81526004016102ea906117d5565b6001600160a01b0382166108de5760405162461bcd60e51b81526004016102ea906117d5565b60fb80546001600160a01b038087166001600160a01b03199283161790925560fc805486841690831617905560fd805492851692909116919091179055801561092d576000805461ff00191690555b50505050565b60fd546040516367a44ca360e01b815260009182916001600160a01b03909116906367a44ca3906109689086906004016113f0565b600060405180830381865afa158015610985573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526109ad91908101906115b5565b60fc54602082015160405163f1eb1a2b60e01b81529293506000926001600160a01b039092169163f1eb1a2b916109ea9160040190815260200190565b600060405180830381865afa158015610a07573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610a2f9190810190611692565b905080608001516001600160801b03163a1115610a835760405162461bcd60e51b815260206004820152601260248201527123b0b9903a37b79032bc3832b739b4bb329760711b60448201526064016102ea565b60a08101516001600160801b0316610a9b813a61175f565b6001600160a01b038616600090815260fe60205260409020541015610b015760405162461bcd60e51b815260206004820152601c60248201527b125b9cdd59999a58da595b9d08195d1a195c8819195c1bdcda5d195960221b60448201526064016102ea565b949350505050565b33610b12610699565b6001600160a01b031614610b385760405162461bcd60e51b81526004016102ea906117a0565b6001600160a01b038116610b9d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102ea565b61043581610ec9565b6001600160a01b038116600090815260fe602052604081208054349290610bce9084906117f9565b90915550506040513481526001600160a01b0382169033907f8752a472e571a816aea92eec8dae9baf628e840f4929fbcc2d155e6233ff68a79060200160405180910390a350565b3b151590565b80471015610c6c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016102ea565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610cb9576040519150601f19603f3d011682016040523d82523d6000602084013e610cbe565b606091505b5050905080610d325760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c20726044820152791958da5c1a595b9d081b585e481a185d99481c995d995c9d195960321b60648201526084016102ea565b505050565b6000805160206118cc833981519152546001600160a01b031690565b33610d5c610699565b6001600160a01b0316146104355760405162461bcd60e51b81526004016102ea906117a0565b6000610d8c610d37565b9050610d9784610fb8565b600083511180610da45750815b15610db557610db3848461104b565b505b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143805460ff16610ec257805460ff19166001178155604051610e30908690610e019085906024016113f0565b60408051601f198184030181529190526020810180516001600160e01b0316631b2ce7f360e11b17905261104b565b50805460ff19168155610e41610d37565b6001600160a01b0316826001600160a01b031614610eb95760405162461bcd60e51b815260206004820152602f60248201527f45524331393637557067726164653a207570677261646520627265616b73206660448201526e75727468657220757067726164657360881b60648201526084016102ea565b610ec285611136565b5050505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16610f425760405162461bcd60e51b81526004016102ea90611811565b610f4a611176565b61069761119d565b600054610100900460ff16610f795760405162461bcd60e51b81526004016102ea90611811565b610f81611176565b610697611176565b600054610100900460ff16610fb05760405162461bcd60e51b81526004016102ea90611811565b6106976111cd565b803b61101c5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016102ea565b6000805160206118cc83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6060823b6110aa5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016102ea565b600080846001600160a01b0316846040516110c5919061185c565b600060405180830381855af49150503d8060008114611100576040519150601f19603f3d011682016040523d82523d6000602084013e611105565b606091505b509150915061112d82826040518060600160405280602781526020016118ec602791396111fb565b95945050505050565b61113f81610fb8565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b600054610100900460ff166106975760405162461bcd60e51b81526004016102ea90611811565b600054610100900460ff166111c45760405162461bcd60e51b81526004016102ea90611811565b61069733610ec9565b600054610100900460ff166111f45760405162461bcd60e51b81526004016102ea90611811565b600160c955565b6060831561120a575081611234565b82511561121a5782518084602001fd5b8160405162461bcd60e51b81526004016102ea9190611878565b9392505050565b6001600160a01b038116811461043557600080fd5b6000806040838503121561126357600080fd5b8235915060208301356112758161123b565b809150509250929050565b60006020828403121561129257600080fd5b81356112348161123b565b634e487b7160e01b600052604160045260246000fd5b60405160c081016001600160401b03811182821017156112d5576112d561129d565b60405290565b604051601f8201601f191681016001600160401b03811182821017156113035761130361129d565b604052919050565b60006001600160401b038211156113245761132461129d565b50601f01601f191660200190565b6000806040838503121561134557600080fd5b82356113508161123b565b915060208301356001600160401b0381111561136b57600080fd5b8301601f8101851361137c57600080fd5b803561138f61138a8261130b565b6112db565b8181528660208385010111156113a457600080fd5b816020840160208301376000602083830101528093505050509250929050565b600080604083850312156113d757600080fd5b82356113e28161123b565b946020939093013593505050565b6001600160a01b0391909116815260200190565b60008060006060848603121561141957600080fd5b83356114248161123b565b95602085013595506040909401359392505050565b60008060006060848603121561144e57600080fd5b83356114598161123b565b925060208401356114698161123b565b915060408401356114798161123b565b809150509250925092565b634e487b7160e01b600052601160045260246000fd5b6000828210156114ac576114ac611484565b500390565b6020808252602c908201526000805160206118ac83398151915260408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201526000805160206118ac83398151915260408201526b6163746976652070726f787960a01b606082015260800190565b80516005811061153457600080fd5b919050565b60005b8381101561155457818101518382015260200161153c565b8381111561092d5750506000910152565b600082601f83011261157657600080fd5b815161158461138a8261130b565b81815284602083860101111561159957600080fd5b610b01826020830160208701611539565b80516115348161123b565b6000602082840312156115c757600080fd5b81516001600160401b03808211156115de57600080fd5b9083019060c082860312156115f257600080fd5b6115fa6112b3565b61160383611525565b8152602083015160208201526040830151604082015260608301518281111561162b57600080fd5b61163787828601611565565b606083015250611649608084016115aa565b608082015260a08301518281111561166057600080fd5b61166c87828601611565565b60a08301525095945050505050565b80516001600160801b038116811461153457600080fd5b6000602082840312156116a457600080fd5b81516001600160401b03808211156116bb57600080fd5b9083019060c082860312156116cf57600080fd5b6116d76112b3565b825181526020830151828111156116ed57600080fd5b6116f987828601611565565b60208301525061170b604084016115aa565b604082015260608301518281111561172257600080fd5b61172e87828601611565565b6060830152506117406080840161167b565b608082015261175160a0840161167b565b60a082015295945050505050565b600081600019048311821515161561177957611779611484565b500290565b60008261179b57634e487b7160e01b600052601260045260246000fd5b500490565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600a90820152696164647265737328302960b01b604082015260600190565b6000821982111561180c5761180c611484565b500190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000825161186e818460208701611539565b9190910192915050565b6020815260008251806020840152611897816040850160208701611539565b601f01601f1916919091016040019291505056fe46756e6374696f6e206d7573742062652063616c6c6564207468726f75676820360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122011da2a35425ffeabe67ecfcc0209a58ddc8ceba349cb5cb484bb1b47633f03bb64736f6c634300080c0033

Deployed ByteCode

0x6080604052600436106100b75760003560e01c8062f714ce146100bc5780633659cfe6146100de5780633cfba0e3146100fe5780634f1ef2861461013e57806361d2be2e14610151578063715018a6146101715780638da5cb5b14610186578063b6e1b3e9146101a8578063b74795d9146101c8578063c0c53b8b146101e8578063cda08c1614610208578063cdd7b38a14610228578063d080bf2714610248578063f2fde38b14610268578063f340fa0114610288575b600080fd5b3480156100c857600080fd5b506100dc6100d7366004611250565b61029b565b005b3480156100ea57600080fd5b506100dc6100f9366004611280565b61036f565b34801561010a57600080fd5b5061012b610119366004611280565b60fe6020526000908152604090205481565b6040519081526020015b60405180910390f35b6100dc61014c366004611332565b610438565b34801561015d57600080fd5b5061012b61016c3660046113c4565b6104f2565b34801561017d57600080fd5b506100dc61065e565b34801561019257600080fd5b5061019b610699565b60405161013591906113f0565b3480156101b457600080fd5b506100dc6101c3366004611404565b6106a8565b3480156101d457600080fd5b5060fb5461019b906001600160a01b031681565b3480156101f457600080fd5b506100dc610203366004611439565b6107b0565b34801561021457600080fd5b5061012b610223366004611280565b610933565b34801561023457600080fd5b5060fd5461019b906001600160a01b031681565b34801561025457600080fd5b5060fc5461019b906001600160a01b031681565b34801561027457600080fd5b506100dc610283366004611280565b610b09565b6100dc610296366004611280565b610ba6565b600260c95414156102f35760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b600260c95533600090815260fe60205260408120805484929061031790849061149a565b90915550506040518281526001600160a01b0382169033907fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb9060200160405180910390a36103668183610c1c565b5050600160c955565b306001600160a01b037f0000000000000000000000009f5b097ad23e2cf4f34e502a3e41d941678877dc1614156103b85760405162461bcd60e51b81526004016102ea906114b1565b7f0000000000000000000000009f5b097ad23e2cf4f34e502a3e41d941678877dc6001600160a01b03166103ea610d37565b6001600160a01b0316146104105760405162461bcd60e51b81526004016102ea906114eb565b61041981610d53565b6040805160008082526020820190925261043591839190610d82565b50565b306001600160a01b037f0000000000000000000000009f5b097ad23e2cf4f34e502a3e41d941678877dc1614156104815760405162461bcd60e51b81526004016102ea906114b1565b7f0000000000000000000000009f5b097ad23e2cf4f34e502a3e41d941678877dc6001600160a01b03166104b3610d37565b6001600160a01b0316146104d95760405162461bcd60e51b81526004016102ea906114eb565b6104e282610d53565b6104ee82826001610d82565b5050565b60fd546040516367a44ca360e01b815260009182916001600160a01b03909116906367a44ca3906105279087906004016113f0565b600060405180830381865afa158015610544573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261056c91908101906115b5565b60fc54602082015160405163f1eb1a2b60e01b81529293506000926001600160a01b039092169163f1eb1a2b916105a99160040190815260200190565b600060405180830381865afa1580156105c6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526105ee9190810190611692565b905080608001516001600160801b031684111561061057600092505050610658565b6000848260a001516001600160801b031661062b919061175f565b6001600160a01b038716600090815260fe602052604090205490915061065290829061177e565b93505050505b92915050565b33610667610699565b6001600160a01b03161461068d5760405162461bcd60e51b81526004016102ea906117a0565b6106976000610ec9565b565b6033546001600160a01b031690565b60fb546001600160a01b031633146107025760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c79206f7263686573747261746f722063616e2063616c6c20746869730060448201526064016102ea565b60005a61070f908461149a565b9050600061071d3a8361175f565b6001600160a01b038616600090815260fe602052604081208054929350839290919061074a90849061149a565b909155505032600090815260fe602090815260409182902080548401905581518381529081018590526001600160a01b038716917f8df42119868c5e2a521d70014ce6857e311acdcf0669c555b17adf8bb53a313a910160405180910390a25050505050565b600054610100900460ff166107cb5760005460ff16156107cf565b303b155b6108325760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016102ea565b600054610100900460ff16158015610854576000805461ffff19166101011790555b61085c610f1b565b610864610f52565b61086c610f89565b6001600160a01b0384166108925760405162461bcd60e51b81526004016102ea906117d5565b6001600160a01b0383166108b85760405162461bcd60e51b81526004016102ea906117d5565b6001600160a01b0382166108de5760405162461bcd60e51b81526004016102ea906117d5565b60fb80546001600160a01b038087166001600160a01b03199283161790925560fc805486841690831617905560fd805492851692909116919091179055801561092d576000805461ff00191690555b50505050565b60fd546040516367a44ca360e01b815260009182916001600160a01b03909116906367a44ca3906109689086906004016113f0565b600060405180830381865afa158015610985573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526109ad91908101906115b5565b60fc54602082015160405163f1eb1a2b60e01b81529293506000926001600160a01b039092169163f1eb1a2b916109ea9160040190815260200190565b600060405180830381865afa158015610a07573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610a2f9190810190611692565b905080608001516001600160801b03163a1115610a835760405162461bcd60e51b815260206004820152601260248201527123b0b9903a37b79032bc3832b739b4bb329760711b60448201526064016102ea565b60a08101516001600160801b0316610a9b813a61175f565b6001600160a01b038616600090815260fe60205260409020541015610b015760405162461bcd60e51b815260206004820152601c60248201527b125b9cdd59999a58da595b9d08195d1a195c8819195c1bdcda5d195960221b60448201526064016102ea565b949350505050565b33610b12610699565b6001600160a01b031614610b385760405162461bcd60e51b81526004016102ea906117a0565b6001600160a01b038116610b9d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102ea565b61043581610ec9565b6001600160a01b038116600090815260fe602052604081208054349290610bce9084906117f9565b90915550506040513481526001600160a01b0382169033907f8752a472e571a816aea92eec8dae9baf628e840f4929fbcc2d155e6233ff68a79060200160405180910390a350565b3b151590565b80471015610c6c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016102ea565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610cb9576040519150601f19603f3d011682016040523d82523d6000602084013e610cbe565b606091505b5050905080610d325760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c20726044820152791958da5c1a595b9d081b585e481a185d99481c995d995c9d195960321b60648201526084016102ea565b505050565b6000805160206118cc833981519152546001600160a01b031690565b33610d5c610699565b6001600160a01b0316146104355760405162461bcd60e51b81526004016102ea906117a0565b6000610d8c610d37565b9050610d9784610fb8565b600083511180610da45750815b15610db557610db3848461104b565b505b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143805460ff16610ec257805460ff19166001178155604051610e30908690610e019085906024016113f0565b60408051601f198184030181529190526020810180516001600160e01b0316631b2ce7f360e11b17905261104b565b50805460ff19168155610e41610d37565b6001600160a01b0316826001600160a01b031614610eb95760405162461bcd60e51b815260206004820152602f60248201527f45524331393637557067726164653a207570677261646520627265616b73206660448201526e75727468657220757067726164657360881b60648201526084016102ea565b610ec285611136565b5050505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16610f425760405162461bcd60e51b81526004016102ea90611811565b610f4a611176565b61069761119d565b600054610100900460ff16610f795760405162461bcd60e51b81526004016102ea90611811565b610f81611176565b610697611176565b600054610100900460ff16610fb05760405162461bcd60e51b81526004016102ea90611811565b6106976111cd565b803b61101c5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016102ea565b6000805160206118cc83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6060823b6110aa5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016102ea565b600080846001600160a01b0316846040516110c5919061185c565b600060405180830381855af49150503d8060008114611100576040519150601f19603f3d011682016040523d82523d6000602084013e611105565b606091505b509150915061112d82826040518060600160405280602781526020016118ec602791396111fb565b95945050505050565b61113f81610fb8565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b600054610100900460ff166106975760405162461bcd60e51b81526004016102ea90611811565b600054610100900460ff166111c45760405162461bcd60e51b81526004016102ea90611811565b61069733610ec9565b600054610100900460ff166111f45760405162461bcd60e51b81526004016102ea90611811565b600160c955565b6060831561120a575081611234565b82511561121a5782518084602001fd5b8160405162461bcd60e51b81526004016102ea9190611878565b9392505050565b6001600160a01b038116811461043557600080fd5b6000806040838503121561126357600080fd5b8235915060208301356112758161123b565b809150509250929050565b60006020828403121561129257600080fd5b81356112348161123b565b634e487b7160e01b600052604160045260246000fd5b60405160c081016001600160401b03811182821017156112d5576112d561129d565b60405290565b604051601f8201601f191681016001600160401b03811182821017156113035761130361129d565b604052919050565b60006001600160401b038211156113245761132461129d565b50601f01601f191660200190565b6000806040838503121561134557600080fd5b82356113508161123b565b915060208301356001600160401b0381111561136b57600080fd5b8301601f8101851361137c57600080fd5b803561138f61138a8261130b565b6112db565b8181528660208385010111156113a457600080fd5b816020840160208301376000602083830101528093505050509250929050565b600080604083850312156113d757600080fd5b82356113e28161123b565b946020939093013593505050565b6001600160a01b0391909116815260200190565b60008060006060848603121561141957600080fd5b83356114248161123b565b95602085013595506040909401359392505050565b60008060006060848603121561144e57600080fd5b83356114598161123b565b925060208401356114698161123b565b915060408401356114798161123b565b809150509250925092565b634e487b7160e01b600052601160045260246000fd5b6000828210156114ac576114ac611484565b500390565b6020808252602c908201526000805160206118ac83398151915260408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201526000805160206118ac83398151915260408201526b6163746976652070726f787960a01b606082015260800190565b80516005811061153457600080fd5b919050565b60005b8381101561155457818101518382015260200161153c565b8381111561092d5750506000910152565b600082601f83011261157657600080fd5b815161158461138a8261130b565b81815284602083860101111561159957600080fd5b610b01826020830160208701611539565b80516115348161123b565b6000602082840312156115c757600080fd5b81516001600160401b03808211156115de57600080fd5b9083019060c082860312156115f257600080fd5b6115fa6112b3565b61160383611525565b8152602083015160208201526040830151604082015260608301518281111561162b57600080fd5b61163787828601611565565b606083015250611649608084016115aa565b608082015260a08301518281111561166057600080fd5b61166c87828601611565565b60a08301525095945050505050565b80516001600160801b038116811461153457600080fd5b6000602082840312156116a457600080fd5b81516001600160401b03808211156116bb57600080fd5b9083019060c082860312156116cf57600080fd5b6116d76112b3565b825181526020830151828111156116ed57600080fd5b6116f987828601611565565b60208301525061170b604084016115aa565b604082015260608301518281111561172257600080fd5b61172e87828601611565565b6060830152506117406080840161167b565b608082015261175160a0840161167b565b60a082015295945050505050565b600081600019048311821515161561177957611779611484565b500290565b60008261179b57634e487b7160e01b600052601260045260246000fd5b500490565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600a90820152696164647265737328302960b01b604082015260600190565b6000821982111561180c5761180c611484565b500190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000825161186e818460208701611539565b9190910192915050565b6020815260008251806020840152611897816040850160208701611539565b601f01601f1916919091016040019291505056fe46756e6374696f6e206d7573742062652063616c6c6564207468726f75676820360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122011da2a35425ffeabe67ecfcc0209a58ddc8ceba349cb5cb484bb1b47633f03bb64736f6c634300080c0033