ETH Price: $2,611.14 (+2.63%)

Contract

0xa01314ECf521e2BF17559623EeB609Ca58A593E3
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Transfer Ownersh...207948162024-09-20 22:34:4727 hrs ago1726871687IN
0xa01314EC...a58A593E3
0 ETH0.0014430125.89954569

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
207947442024-09-20 22:20:2327 hrs ago1726870823  Contract Creation0 ETH
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0xa041583d...2663Af173
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
AeraVaultHooks

Compiler Version
v0.8.21+commit.d9974bed

Optimization Enabled:
Yes with 1000 runs

Other Settings:
shanghai EvmVersion, BSL 1.1 license
File 1 of 24 : AeraVaultHooks.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.21;

import "@openzeppelin/IERC20.sol";
import "@openzeppelin/ERC165.sol";
import "@openzeppelin/SafeERC20.sol";
import "@openzeppelin/IERC20IncreaseAllowance.sol";
import "./interfaces/IHooks.sol";
import "./interfaces/IAeraVaultHooksEvents.sol";
import "./interfaces/IVault.sol";
import "./Sweepable.sol";
import "./TargetSighashLib.sol";
import "./Types.sol";
import {ONE} from "./Constants.sol";

/// @title AeraVaultHooks
/// @notice Default hooks contract which implements several safeguards.
/// @dev Connected vault MUST only call submit with tokens that can increase allowances with approve and increaseAllowance.
contract AeraVaultHooks is IHooks, IAeraVaultHooksEvents, Sweepable, ERC165 {
    using SafeERC20 for IERC20;

    /// @notice Min bound on minimum fraction of vault value that the vault has to retain
    ///         between submissions during a single day.
    /// @dev    Loose bound to mitigate initialization error.
    uint256 private constant _LOWEST_MIN_DAILY_VALUE = ONE / 2;

    /// @notice The minimum fraction of vault value that the vault has to
    ///         retain per day during submit transactions.
    ///         e.g. 0.9 (in 18-decimal form) allows the vault to lose up to
    ///         10% in value across consecutive submissions.
    uint256 public immutable minDailyValue;

    /// STORAGE ///

    /// @notice The address of the vault.
    address public vault;

    /// @notice Current day (UTC).
    uint256 public currentDay;

    /// @notice Accumulated value multiplier during submit transactions.
    uint256 public cumulativeDailyMultiplier;

    /// @notice Allowed target contract and sighash combinations.
    mapping(TargetSighash => bool) internal _targetSighashAllowed;

    /// @notice Total value of assets in vault before submission.
    /// @dev Assigned in `beforeSubmit` and used in `afterSubmit`.
    uint256 internal _beforeValue;

    /// ERRORS ///

    error Aera__CallerIsNotVault();
    error Aera__VaultIsZeroAddress();
    error Aera__HooksOwnerIsGuardian();
    error Aera__HooksOwnerIsVault();
    error Aera__MinDailyValueTooLow();
    error Aera__MinDailyValueIsNotLessThanOne();
    error Aera__NoCodeAtTarget(address target);
    error Aera__CallIsNotAllowed(Operation operation);
    error Aera__VaultValueBelowMinDailyValue();
    error Aera__AllowanceIsNotZero(address asset, address spender);
    error Aera__HooksInitialOwnerIsZeroAddress();
    error Aera__RemovingNonexistentTargetSighash(TargetSighash targetSighash);
    error Aera__AddingDuplicateTargetSighash(TargetSighash targetSighash);

    /// MODIFIERS ///

    /// @dev Throws if called by any account other than the vault.
    modifier onlyVault() {
        if (msg.sender != vault) {
            revert Aera__CallerIsNotVault();
        }
        _;
    }

    /// FUNCTIONS ///

    /// @param owner_ Initial owner address.
    /// @param vault_ Vault address.
    /// @param minDailyValue_ The minimum fraction of value that the vault has to retain
    ///                       during the day in the course of submissions.
    /// @param targetSighashAllowlist Array of target contract and sighash combinations to allow.
    constructor(
        address owner_,
        address vault_,
        uint256 minDailyValue_,
        TargetSighashData[] memory targetSighashAllowlist
    ) Ownable() {
        // Requirements: validate vault.
        if (vault_ == address(0)) {
            revert Aera__VaultIsZeroAddress();
        }
        if (owner_ == address(0)) {
            revert Aera__HooksInitialOwnerIsZeroAddress();
        }

        // Requirements: check that hooks initial owner is disaffiliated.
        if (owner_ == vault_) {
            revert Aera__HooksOwnerIsVault();
        }
        // Only check vault if it has been deployed already.
        // This will happen if we are deploying a new Hooks contract for an existing vault.
        if (vault_.code.length > 0) {
            address guardian = IVault(vault_).guardian();
            if (owner_ == guardian) {
                revert Aera__HooksOwnerIsGuardian();
            }
        }

        // Requirements: check that minimum daily value doesn't mandate vault growth.
        if (minDailyValue_ >= ONE) {
            revert Aera__MinDailyValueIsNotLessThanOne();
        }

        // Requirements: check that minimum daily value enforces a lower bound.
        if (minDailyValue_ < _LOWEST_MIN_DAILY_VALUE) {
            revert Aera__MinDailyValueTooLow();
        }

        uint256 numTargetSighashAllowlist = targetSighashAllowlist.length;

        // Effects: initialize target sighash allowlist.
        for (uint256 i = 0; i < numTargetSighashAllowlist;) {
            _addTargetSighash(
                targetSighashAllowlist[i].target,
                targetSighashAllowlist[i].selector
            );

            unchecked {
                i++; // gas savings
            }
        }

        // Effects: initialize state variables.
        vault = vault_;
        minDailyValue = minDailyValue_;
        currentDay = block.timestamp / 1 days;
        cumulativeDailyMultiplier = ONE;

        // Effects: set new owner.
        _transferOwnership(owner_);
    }

    /// @notice Add targetSighash pair to allowlist.
    /// @param target Address of target.
    /// @param selector Selector of function.
    function addTargetSighash(
        address target,
        bytes4 selector
    ) external onlyOwner {
        _addTargetSighash(target, selector);
    }

    /// @notice Remove targetSighash pair from allowlist.
    /// @param target Address of target.
    /// @param selector Selector of function.
    function removeTargetSighash(
        address target,
        bytes4 selector
    ) external onlyOwner {
        TargetSighash targetSighash =
            TargetSighashLib.toTargetSighash(target, selector);

        // Requirements: check that current target sighash is set.
        if (!_targetSighashAllowed[targetSighash]) {
            revert Aera__RemovingNonexistentTargetSighash(targetSighash);
        }

        // Effects: remove target sighash combination from the allowlist.
        delete _targetSighashAllowed[targetSighash];

        // Log the removal.
        emit TargetSighashRemoved(target, selector);
    }

    /// @inheritdoc IHooks
    function beforeDeposit(AssetValue[] memory amounts)
        external
        override
        onlyVault
    {}

    /// @inheritdoc IHooks
    function afterDeposit(AssetValue[] memory amounts)
        external
        override
        onlyVault
    {}

    /// @inheritdoc IHooks
    function beforeWithdraw(AssetValue[] memory amounts)
        external
        override
        onlyVault
    {}

    /// @inheritdoc IHooks
    function afterWithdraw(AssetValue[] memory amounts)
        external
        override
        onlyVault
    {}

    /// @inheritdoc IHooks
    function beforeSubmit(Operation[] calldata operations)
        external
        override
        onlyVault
    {
        uint256 numOperations = operations.length;
        bytes4 selector;

        // Requirements: validate that all operations are allowed.
        for (uint256 i = 0; i < numOperations;) {
            selector = bytes4(operations[i].data[0:4]);

            TargetSighash sigHash = TargetSighashLib.toTargetSighash(
                operations[i].target, selector
            );

            // Requirements: validate that the target sighash combination is allowed.
            if (!_targetSighashAllowed[sigHash]) {
                revert Aera__CallIsNotAllowed(operations[i]);
            }

            unchecked {
                i++;
            } // gas savings
        }

        // Effects: remember current vault value and ETH balance for use in afterSubmit.
        _beforeValue = IVault(vault).value();
    }

    /// @inheritdoc IHooks
    function afterSubmit(Operation[] calldata operations)
        external
        override
        onlyVault
    {
        uint256 newMultiplier;
        uint256 currentMultiplier = cumulativeDailyMultiplier;
        uint256 day = block.timestamp / 1 days;

        if (_beforeValue > 0) {
            // Initialize new cumulative multiplier with the current submit multiplier.
            newMultiplier = currentDay == day ? currentMultiplier : ONE;
            newMultiplier =
                (newMultiplier * IVault(vault).value()) / _beforeValue;

            // Requirements: check that daily execution loss is within bounds.
            if (newMultiplier < minDailyValue) {
                revert Aera__VaultValueBelowMinDailyValue();
            }

            // Effects: update the daily multiplier.
            if (currentMultiplier != newMultiplier) {
                cumulativeDailyMultiplier = newMultiplier;
            }
        }

        // Effects: reset current day for the next submission.
        if (currentDay != day) {
            currentDay = day;
        }

        // Effects: reset prior vault value for the next submission.
        _beforeValue = 0;

        uint256 numOperations = operations.length;
        bytes4 selector;
        address spender;
        uint256 amount;
        IERC20 token;

        // Requirements: check that there are no outgoing allowances that were introduced.
        for (uint256 i = 0; i < numOperations;) {
            selector = bytes4(operations[i].data[0:4]);
            if (_isAllowanceSelector(selector)) {
                // Extract spender and amount from the allowance transaction.
                (spender, amount) =
                    abi.decode(operations[i].data[4:], (address, uint256));

                // If amount is 0 then allowance hasn't been increased.
                if (amount == 0) {
                    unchecked {
                        i++;
                    } // gas savings
                    continue;
                }

                token = IERC20(operations[i].target);

                // Requirements: check that the current outgoing allowance for this token is zero.
                if (token.allowance(vault, spender) > 0) {
                    revert Aera__AllowanceIsNotZero(address(token), spender);
                }
            }
            unchecked {
                i++;
            } // gas savings
        }
    }

    /// @inheritdoc IHooks
    function beforeFinalize() external override onlyVault {}

    /// @inheritdoc IHooks
    function afterFinalize() external override onlyVault {
        // Effects: release storage
        currentDay = 0;
        cumulativeDailyMultiplier = 0;
    }

    /// @inheritdoc IHooks
    function decommission() external override onlyVault {
        // Effects: reset vault address.
        vault = address(0);

        // Effects: release storage
        currentDay = 0;
        cumulativeDailyMultiplier = 0;

        // Log decommissioning.
        emit Decommissioned();
    }

    /// @inheritdoc IERC165
    function supportsInterface(bytes4 interfaceId)
        public
        view
        override
        returns (bool)
    {
        return interfaceId == type(IHooks).interfaceId
            || super.supportsInterface(interfaceId);
    }

    /// @notice Check whether target and sighash combination is allowed.
    /// @param target Address of target.
    /// @param selector Selector of function.
    function targetSighashAllowed(
        address target,
        bytes4 selector
    ) external view returns (bool) {
        return _targetSighashAllowed[TargetSighashLib.toTargetSighash(
            target, selector
        )];
    }

    /// INTERNAL FUNCTIONS ///

    /// @notice Add targetSighash pair to allowlist.
    /// @param target Address of target.
    /// @param selector Selector of function.
    function _addTargetSighash(address target, bytes4 selector) internal {
        // Requirements: check there is code at target.
        if (target.code.length == 0) {
            revert Aera__NoCodeAtTarget(target);
        }

        TargetSighash targetSighash =
            TargetSighashLib.toTargetSighash(target, selector);

        // Requirements: check that current target sighash is not set.
        if (_targetSighashAllowed[targetSighash]) {
            revert Aera__AddingDuplicateTargetSighash(targetSighash);
        }

        // Effects: add target sighash combination to the allowlist.
        _targetSighashAllowed[targetSighash] = true;

        // Log the addition.
        emit TargetSighashAdded(target, selector);
    }

    /// @notice Check whether selector is allowance related selector or not.
    /// @param selector Selector of calldata to check.
    /// @return isAllowanceSelector True if selector is allowance related selector.
    function _isAllowanceSelector(bytes4 selector)
        internal
        pure
        returns (bool isAllowanceSelector)
    {
        return selector == IERC20.approve.selector
            || selector == IERC20IncreaseAllowance.increaseAllowance.selector;
    }

    /// @notice Check that owner is not the vault or the guardian.
    /// @param owner_ Hooks owner address.
    /// @param vault_ Vault address.
    function _checkHooksOwner(address owner_, address vault_) internal view {
        if (owner_ == vault_) {
            revert Aera__HooksOwnerIsVault();
        }

        address guardian = IVault(vault_).guardian();
        if (owner_ == guardian) {
            revert Aera__HooksOwnerIsGuardian();
        }
    }

    /// @inheritdoc Ownable2Step
    function transferOwnership(address newOwner) public override onlyOwner {
        // Requirements: check that new owner is disaffiliated from existing roles.
        _checkHooksOwner(newOwner, vault);

        // Effects: initiate ownership transfer.
        super.transferOwnership(newOwner);
    }
}

File 2 of 24 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 3 of 24 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 4 of 24 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./IERC20Permit.sol";
import "./Address.sol";

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

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

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

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to
     * 0 before setting it to a non-zero value.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

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

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

File 5 of 24 : IERC20IncreaseAllowance.sol
pragma solidity ^0.8.0;

/**
 * @dev ERC20 but not IERC20 defines increaseAllowance
 */
interface IERC20IncreaseAllowance {
    /** 
     *  Atomically increases the allowance granted to spender by the caller. 
     *  This is an alternative to approve that can be used as a mitigation for 
     *  problems described in IERC20.approve. 
     *  Emits an Approval event indicating the updated allowance.
     *  Requirements: 
     *  spender cannot be the zero address.
     */ 
    function increaseAllowance(address spender, uint256 amount) external returns (bool);

}

File 6 of 24 : IHooks.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.21;

import {AssetValue, Operation} from "../Types.sol";

/// @title IHooks
/// @notice Interface for the hooks module.
interface IHooks {
    /// @notice Get address of vault.
    /// @return vault Vault address.
    function vault() external view returns (address vault);

    /// @notice Hook that runs before deposit.
    /// @param amounts Struct details for assets and amounts to deposit.
    /// @dev MUST revert if not called by vault.
    function beforeDeposit(AssetValue[] memory amounts) external;

    /// @notice Hook that runs after deposit.
    /// @param amounts Struct details for assets and amounts to deposit.
    /// @dev MUST revert if not called by vault.
    function afterDeposit(AssetValue[] memory amounts) external;

    /// @notice Hook that runs before withdraw.
    /// @param amounts Struct details for assets and amounts to withdraw.
    /// @dev MUST revert if not called by vault.
    function beforeWithdraw(AssetValue[] memory amounts) external;

    /// @notice Hook that runs after withdraw.
    /// @param amounts Struct details for assets and amounts to withdraw.
    /// @dev MUST revert if not called by vault.
    function afterWithdraw(AssetValue[] memory amounts) external;

    /// @notice Hook that runs before submit.
    /// @param operations Array of struct details for target and calldata to submit.
    /// @dev MUST revert if not called by vault.
    function beforeSubmit(Operation[] memory operations) external;

    /// @notice Hook that runs after submit.
    /// @param operations Array of struct details for target and calldata to submit.
    /// @dev MUST revert if not called by vault.
    function afterSubmit(Operation[] memory operations) external;

    /// @notice Hook that runs before finalize.
    /// @dev MUST revert if not called by vault.
    function beforeFinalize() external;

    /// @notice Hook that runs after finalize.
    /// @dev MUST revert if not called by vault.
    function afterFinalize() external;

    /// @notice Take hooks out of use.
    function decommission() external;
}

File 7 of 24 : IAeraVaultHooksEvents.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.21;

import {TargetSighash} from "../Types.sol";

/// @title Events emitted by AeraVaultHooks implementation.
interface IAeraVaultHooksEvents {
    /// @notice Emitted when targetSighash is added to allowlist.
    /// @param target Address of target.
    /// @param selector Selector of function.
    event TargetSighashAdded(address indexed target, bytes4 indexed selector);

    /// @notice Emitted when targetSighash is removed from allowlist.
    /// @param target Address of target.
    /// @param selector Selector of function.
    event TargetSighashRemoved(
        address indexed target, bytes4 indexed selector
    );

    /// @notice Emitted when hooks contract is decommissioned.
    event Decommissioned();
}

File 8 of 24 : IVault.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.21;

import "@openzeppelin/IERC20.sol";
import "./IAssetRegistry.sol";
import "./IVaultEvents.sol";
import "./IHooks.sol";

/// @title IVault
/// @notice Interface for the vault.
/// @dev Any implementation MUST also implement Ownable2Step.
interface IVault is IVaultEvents {
    /// ERRORS ///

    error Aera__AssetRegistryIsZeroAddress();
    error Aera__AssetRegistryIsNotValid(address assetRegistry);
    error Aera__AssetRegistryHasInvalidVault();
    error Aera__HooksIsZeroAddress();
    error Aera__HooksIsNotValid(address hooks);
    error Aera__HooksHasInvalidVault();
    error Aera__GuardianIsZeroAddress();
    error Aera__GuardianIsOwner();
    error Aera__InitialOwnerIsZeroAddress();
    error Aera__FeeRecipientIsZeroAddress();
    error Aera__ExecuteTargetIsHooksAddress();
    error Aera__ExecuteTargetIsVaultAddress();
    error Aera__SubmitTransfersAssetFromOwner();
    error Aera__SubmitRedeemERC4626AssetFromOwner();
    error Aera__SubmitTargetIsVaultAddress();
    error Aera__SubmitTargetIsHooksAddress(uint256 index);
    error Aera__FeeRecipientIsOwner();
    error Aera__FeeIsAboveMax(uint256 actual, uint256 max);
    error Aera__CallerIsNotOwnerAndGuardian();
    error Aera__CallerIsNotGuardian();
    error Aera__AssetIsNotRegistered(IERC20 asset);
    error Aera__AmountExceedsAvailable(
        IERC20 asset, uint256 amount, uint256 available
    );
    error Aera__ExecutionFailed(bytes result);
    error Aera__VaultIsFinalized();
    error Aera__SubmissionFailed(uint256 index, bytes result);
    error Aera__CannotUseReservedFees();
    error Aera__SpotPricesReverted();
    error Aera__AmountsOrderIsIncorrect(uint256 index);
    error Aera__NoAvailableFeesForCaller(address caller);
    error Aera__NoClaimableFeesForCaller(address caller);
    error Aera__NotWrappedNativeTokenContract();
    error Aera__CannotRenounceOwnership();

    /// FUNCTIONS ///

    /// @notice Deposit assets.
    /// @param amounts Assets and amounts to deposit.
    /// @dev MUST revert if not called by owner.
    function deposit(AssetValue[] memory amounts) external;

    /// @notice Withdraw assets.
    /// @param amounts Assets and amounts to withdraw.
    /// @dev MUST revert if not called by owner.
    function withdraw(AssetValue[] memory amounts) external;

    /// @notice Set current guardian and fee recipient.
    /// @param guardian New guardian address.
    /// @param feeRecipient New fee recipient address.
    /// @dev MUST revert if not called by owner.
    function setGuardianAndFeeRecipient(
        address guardian,
        address feeRecipient
    ) external;

    /// @notice Sets the current hooks module.
    /// @param hooks New hooks module address.
    /// @dev MUST revert if not called by owner.
    function setHooks(address hooks) external;

    /// @notice Execute a transaction via the vault.
    /// @dev Execution still should work when vault is finalized.
    /// @param operation Struct details for target and calldata to execute.
    /// @dev MUST revert if not called by owner.
    function execute(Operation memory operation) external;

    /// @notice Terminate the vault and return all funds to owner.
    /// @dev MUST revert if not called by owner.
    function finalize() external;

    /// @notice Stops the guardian from submission and halts fee accrual.
    /// @dev MUST revert if not called by owner or guardian.
    function pause() external;

    /// @notice Resume fee accrual and guardian submissions.
    /// @dev MUST revert if not called by owner.
    function resume() external;

    /// @notice Submit a series of transactions for execution via the vault.
    /// @param operations Sequence of operations to execute.
    /// @dev MUST revert if not called by guardian.
    function submit(Operation[] memory operations) external;

    /// @notice Claim fees on behalf of a current or previous fee recipient.
    function claim() external;

    /// @notice Get the current guardian.
    /// @return guardian Address of guardian.
    function guardian() external view returns (address guardian);

    /// @notice Get the current fee recipient.
    /// @return feeRecipient Address of fee recipient.
    function feeRecipient() external view returns (address feeRecipient);

    /// @notice Get the current asset registry.
    /// @return assetRegistry Address of asset registry.
    function assetRegistry()
        external
        view
        returns (IAssetRegistry assetRegistry);

    /// @notice Get the current hooks module address.
    /// @return hooks Address of hooks module.
    function hooks() external view returns (IHooks hooks);

    /// @notice Get fee per second.
    /// @return fee Fee per second in 18 decimal fixed point format.
    function fee() external view returns (uint256 fee);

    /// @notice Get current balances of all assets.
    /// @return assetAmounts Amounts of registered assets.
    function holdings()
        external
        view
        returns (AssetValue[] memory assetAmounts);

    /// @notice Get current total value of assets in vault.
    /// @return value Current total value.
    function value() external view returns (uint256 value);
}

File 9 of 24 : Sweepable.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.21;

import "@openzeppelin/Ownable2Step.sol";
import "@openzeppelin/SafeERC20.sol";
import "./interfaces/ISweepable.sol";

/// @title Sweepable.
/// @notice Aera Sweepable contract.
/// @dev Allows owner of the contract to restore accidentally send tokens
//       and the chain's native token.
contract Sweepable is ISweepable, Ownable2Step {
    using SafeERC20 for IERC20;

    /// @inheritdoc ISweepable
    function sweep(address token, uint256 amount) external onlyOwner {
        if (token == address(0)) {
            msg.sender.call{value: amount}("");
        } else {
            IERC20(token).safeTransfer(msg.sender, amount);
        }

        emit Sweep(token, amount);
    }
}

File 10 of 24 : TargetSighashLib.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.21;

import {TargetSighash} from "./Types.sol";

/// @title TargetSighashLib
/// @notice Conversion operations for the TargetSighash compound type.
library TargetSighashLib {
    /// @notice Get sighash from target and selector.
    /// @param target Target contract address.
    /// @param selector Function selector.
    /// @return targetSighash Packed value of target and selector.
    function toTargetSighash(
        address target,
        bytes4 selector
    ) internal pure returns (TargetSighash targetSighash) {
        targetSighash = TargetSighash.wrap(
            bytes20(target) | (bytes32(selector) >> (20 * 8))
        );
    }
}

File 11 of 24 : Types.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.21;

import "@openzeppelin/IERC20.sol";
import "./interfaces/IAssetRegistry.sol";

// Types.sol
//
// This file defines the types used in V2.

/// @notice Combination of contract address and sighash to be used in allowlist.
/// @dev It's packed as follows:
///      [target 160 bits] [selector 32 bits] [<empty> 64 bits]
type TargetSighash is bytes32;

/// @notice Struct encapulating an asset and an associated value.
/// @param asset Asset address.
/// @param value The associated value for this asset (e.g., amount or price).
struct AssetValue {
    IERC20 asset;
    uint256 value;
}

/// @notice Execution details for a vault operation.
/// @param target Target contract address.
/// @param value Native token amount.
/// @param data Calldata.
struct Operation {
    address target;
    uint256 value;
    bytes data;
}

/// @notice Contract address and sighash struct to be used in the public interface.
struct TargetSighashData {
    address target;
    bytes4 selector;
}

/// @notice Parameters for vault deployment.
/// @param owner Initial owner address.
/// @param assetRegistry Asset registry address.
/// @param hooks Hooks address.
/// @param guardian Guardian address.
/// @param feeRecipient Fee recipient address.
/// @param fee Fees accrued per second, denoted in 18 decimal fixed point format.
struct Parameters {
    address owner;
    address assetRegistry;
    address hooks;
    address guardian;
    address feeRecipient;
    uint256 fee;
}

/// @notice Vault parameters for vault deployment.
/// @param owner Initial owner address.
/// @param guardian Guardian address.
/// @param feeRecipient Fee recipient address.
/// @param fee Fees accrued per second, denoted in 18 decimal fixed point format.
struct VaultParameters {
    address owner;
    address guardian;
    address feeRecipient;
    uint256 fee;
}

/// @notice Asset registry parameters for asset registry deployment.
/// @param factory Asset registry factory address.
/// @param owner Initial owner address.
/// @param assets Initial list of registered assets.
/// @param numeraireToken Numeraire token address.
/// @param feeToken Fee token address.
/// @param sequencer Sequencer Uptime Feed address for L2.
struct AssetRegistryParameters {
    address factory;
    address owner;
    IAssetRegistry.AssetInformation[] assets;
    IERC20 numeraireToken;
    IERC20 feeToken;
    AggregatorV2V3Interface sequencer;
}

/// @notice Hooks parameters for hooks deployment.
/// @param factory Hooks factory address.
/// @param owner Initial owner address.
/// @param minDailyValue The fraction of value that the vault has to retain per day
///                      in the course of submissions.
/// @param targetSighashAllowlist Array of target contract and sighash combinations to allow.
struct HooksParameters {
    address factory;
    address owner;
    uint256 minDailyValue;
    TargetSighashData[] targetSighashAllowlist;
}

File 12 of 24 : Constants.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.21;

// Constants.sol
//
// This file defines the constants used across several contracts in V2.

/// @dev Fixed point multiplier.
uint256 constant ONE = 1e18;

File 13 of 24 : IERC165.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 IERC165 {
    /**
     * @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);
}

File 14 of 24 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

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

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

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

File 15 of 24 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/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.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

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

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

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

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

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

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

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

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

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

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

File 16 of 24 : IAssetRegistry.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.21;

import "@chainlink/interfaces/AggregatorV2V3Interface.sol";
import "@openzeppelin/IERC20.sol";

/// @title IAssetRegistry
/// @notice Asset registry interface.
/// @dev Any implementation MUST also implement Ownable2Step and ERC165.
interface IAssetRegistry {
    /// @param asset Asset address.
    /// @param heartbeat Frequency of oracle price updates.
    /// @param isERC4626 True if yield-bearing asset, false if just an ERC20 asset.
    /// @param oracle If applicable, oracle address for asset.
    struct AssetInformation {
        IERC20 asset;
        uint256 heartbeat;
        bool isERC4626;
        AggregatorV2V3Interface oracle;
    }

    /// @param asset Asset address.
    /// @param spotPrice Spot price of an asset in Numeraire token terms.
    struct AssetPriceReading {
        IERC20 asset;
        uint256 spotPrice;
    }

    /// @notice Get address of vault.
    /// @return vault Address of vault.
    function vault() external view returns (address vault);

    /// @notice Get a list of all registered assets.
    /// @return assets List of assets.
    /// @dev MUST return assets in an order sorted by address.
    function assets()
        external
        view
        returns (AssetInformation[] memory assets);

    /// @notice Get address of fee token.
    /// @return feeToken Address of fee token.
    /// @dev Represented as an address for efficiency reasons.
    /// @dev MUST be present in assets array.
    function feeToken() external view returns (IERC20 feeToken);

    /// @notice Get the index of the Numeraire token in the assets array.
    /// @return numeraireToken Numeraire token address.
    /// @dev Represented as an index for efficiency reasons.
    /// @dev MUST be a number between 0 (inclusive) and the length of assets array (exclusive).
    function numeraireToken() external view returns (IERC20 numeraireToken);

    /// @notice Calculate spot prices of non-ERC4626 assets.
    /// @return spotPrices Spot prices of non-ERC4626 assets in 18 decimals.
    /// @dev MUST return assets in the same order as in assets but with ERC4626 assets filtered out.
    /// @dev MUST also include Numeraire token (spot price = 1).
    /// @dev MAY revert if oracle prices for any asset are unreliable at the time.
    function spotPrices()
        external
        view
        returns (AssetPriceReading[] memory spotPrices);
}

File 17 of 24 : IVaultEvents.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.21;

import "@openzeppelin/IERC20.sol";

import {AssetValue, Operation} from "../Types.sol";

/// @title Interface for vault events.
interface IVaultEvents {
    /// @notice Emitted when deposit is called.
    /// @param owner Owner address.
    /// @param asset Deposited asset.
    /// @param amount Deposited asset amount.
    event Deposit(address indexed owner, IERC20 indexed asset, uint256 amount);

    /// @notice Emitted when withdraw is called.
    /// @param owner Owner address.
    /// @param asset Withdrawn asset.
    /// @param amount Withdrawn asset amount.
    event Withdraw(
        address indexed owner, IERC20 indexed asset, uint256 amount
    );

    /// @notice Emitted when guardian is set.
    /// @param guardian Address of new guardian.
    /// @param feeRecipient Address of new fee recipient.
    event SetGuardianAndFeeRecipient(
        address indexed guardian, address indexed feeRecipient
    );

    /// @notice Emitted when asset registry is set.
    /// @param assetRegistry Address of new asset registry.
    event SetAssetRegistry(address assetRegistry);

    /// @notice Emitted when hooks is set.
    /// @param hooks Address of new hooks.
    event SetHooks(address hooks);

    /// @notice Emitted when execute is called.
    /// @param owner Owner address.
    /// @param operation Struct details for target and calldata.
    event Executed(address indexed owner, Operation operation);

    /// @notice Emitted when vault is finalized.
    /// @param owner Owner address.
    /// @param withdrawnAmounts Struct details for withdrawn assets and amounts (sent to owner).
    event Finalized(address indexed owner, AssetValue[] withdrawnAmounts);

    /// @notice Emitted when submit is called.
    /// @param guardian Guardian address.
    /// @param operations Array of struct details for targets and calldatas.
    event Submitted(address indexed guardian, Operation[] operations);

    /// @notice Emitted when guardian fees are claimed.
    /// @param feeRecipient Fee recipient address.
    /// @param claimedFee Claimed amount of fee token.
    /// @param unclaimedFee Unclaimed amount of fee token (unclaimed because Vault does not have enough balance of feeToken).
    /// @param feeTotal New total reserved fee value.
    event Claimed(
        address indexed feeRecipient,
        uint256 claimedFee,
        uint256 unclaimedFee,
        uint256 feeTotal
    );

    /// @notice Emitted when new fees are reserved for recipient.
    /// @param feeRecipient Fee recipient address.
    /// @param newFee Fee amount reserved.
    /// @param lastFeeCheckpoint Updated fee checkpoint.
    /// @param lastValue Last registered vault value.
    /// @param lastFeeTokenPrice Last registered fee token price.
    /// @param feeTotal New total reserved fee value.
    event FeesReserved(
        address indexed feeRecipient,
        uint256 newFee,
        uint256 lastFeeCheckpoint,
        uint256 lastValue,
        uint256 lastFeeTokenPrice,
        uint256 feeTotal
    );

    /// @notice Emitted when no fees are reserved.
    /// @param lastFeeCheckpoint Updated fee checkpoint.
    /// @param lastValue Last registered vault value.
    /// @param feeTotal New total reserved fee value.
    event NoFeesReserved(
        uint256 lastFeeCheckpoint,
        uint256 lastValue,
        uint256 feeTotal
    );

    /// @notice Emitted when the call to get spot prices from the asset registry reverts.
    /// @param reason Revert reason.
    event SpotPricesReverted(bytes reason);
}

File 18 of 24 : Ownable2Step.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)

pragma solidity ^0.8.0;

import "./Ownable.sol";

/**
 * @dev Contract module which provides 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} and {acceptOwnership}.
 *
 * This module is used through inheritance. It will make available all functions
 * from parent (Ownable).
 */
abstract contract Ownable2Step is Ownable {
    address private _pendingOwner;

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

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

    /**
     * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual override onlyOwner {
        _pendingOwner = newOwner;
        emit OwnershipTransferStarted(owner(), newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual override {
        delete _pendingOwner;
        super._transferOwnership(newOwner);
    }

    /**
     * @dev The new owner accepts the ownership transfer.
     */
    function acceptOwnership() public virtual {
        address sender = _msgSender();
        require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner");
        _transferOwnership(sender);
    }
}

File 19 of 24 : ISweepable.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.21;

/// @title Interface for sweepable module.
interface ISweepable {
    /// @notice Emitted when sweep is called.
    /// @param token Token address or zero address if recovering the chain's native token.
    /// @param amount Withdrawn amount of token.
    event Sweep(address token, uint256 amount);

    /// @notice Withdraw any tokens accidentally sent to contract.
    /// @param token Token address to withdraw or zero address for the chain's native token.
    /// @param amount Amount to withdraw.
    function sweep(address token, uint256 amount) external;
}

File 20 of 24 : AggregatorV2V3Interface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./AggregatorInterface.sol";
import "./AggregatorV3Interface.sol";

interface AggregatorV2V3Interface is AggregatorInterface, AggregatorV3Interface {}

File 21 of 24 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "./Context.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 Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        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);
    }
}

File 22 of 24 : AggregatorInterface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface AggregatorInterface {
  function latestAnswer() external view returns (int256);

  function latestTimestamp() external view returns (uint256);

  function latestRound() external view returns (uint256);

  function getAnswer(uint256 roundId) external view returns (int256);

  function getTimestamp(uint256 roundId) external view returns (uint256);

  event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt);

  event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt);
}

File 23 of 24 : AggregatorV3Interface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface AggregatorV3Interface {
  function decimals() external view returns (uint8);

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

  function version() external view returns (uint256);

  // getRoundData and latestRoundData should both raise "No data present"
  // if they do not have data to report, instead of returning unset values
  // which could be misinterpreted as actual reported values.
  function getRoundData(uint80 _roundId)
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );

  function latestRoundData()
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );
}

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

pragma solidity ^0.8.0;

/**
 * @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 Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

Settings
{
  "remappings": [
    "src/=src/",
    "test/=test/",
    "@chainlink/=src/v2/dependencies/chainlink/",
    "@openzeppelin/=src/v2/dependencies/openzeppelin/",
    "@uniswap/v3-periphery/=lib/v3-periphery/",
    "@uniswap/v3-core/=lib/v3-core/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "v3-core/=lib/v3-core/",
    "v3-periphery/=lib/v3-periphery/contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 1000
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  },
  "evmVersion": "shanghai",
  "viaIR": true,
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"owner_","type":"address"},{"internalType":"address","name":"vault_","type":"address"},{"internalType":"uint256","name":"minDailyValue_","type":"uint256"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes4","name":"selector","type":"bytes4"}],"internalType":"struct TargetSighashData[]","name":"targetSighashAllowlist","type":"tuple[]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"TargetSighash","name":"targetSighash","type":"bytes32"}],"name":"Aera__AddingDuplicateTargetSighash","type":"error"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"Aera__AllowanceIsNotZero","type":"error"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Operation","name":"operation","type":"tuple"}],"name":"Aera__CallIsNotAllowed","type":"error"},{"inputs":[],"name":"Aera__CallerIsNotVault","type":"error"},{"inputs":[],"name":"Aera__HooksInitialOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"Aera__HooksOwnerIsGuardian","type":"error"},{"inputs":[],"name":"Aera__HooksOwnerIsVault","type":"error"},{"inputs":[],"name":"Aera__MinDailyValueIsNotLessThanOne","type":"error"},{"inputs":[],"name":"Aera__MinDailyValueTooLow","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"Aera__NoCodeAtTarget","type":"error"},{"inputs":[{"internalType":"TargetSighash","name":"targetSighash","type":"bytes32"}],"name":"Aera__RemovingNonexistentTargetSighash","type":"error"},{"inputs":[],"name":"Aera__VaultIsZeroAddress","type":"error"},{"inputs":[],"name":"Aera__VaultValueBelowMinDailyValue","type":"error"},{"anonymous":false,"inputs":[],"name":"Decommissioned","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Sweep","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":true,"internalType":"bytes4","name":"selector","type":"bytes4"}],"name":"TargetSighashAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":true,"internalType":"bytes4","name":"selector","type":"bytes4"}],"name":"TargetSighashRemoved","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes4","name":"selector","type":"bytes4"}],"name":"addTargetSighash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"contract IERC20","name":"asset","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"internalType":"struct AssetValue[]","name":"amounts","type":"tuple[]"}],"name":"afterDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"afterFinalize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Operation[]","name":"operations","type":"tuple[]"}],"name":"afterSubmit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"contract IERC20","name":"asset","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"internalType":"struct AssetValue[]","name":"amounts","type":"tuple[]"}],"name":"afterWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"contract IERC20","name":"asset","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"internalType":"struct AssetValue[]","name":"amounts","type":"tuple[]"}],"name":"beforeDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"beforeFinalize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Operation[]","name":"operations","type":"tuple[]"}],"name":"beforeSubmit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"contract IERC20","name":"asset","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"internalType":"struct AssetValue[]","name":"amounts","type":"tuple[]"}],"name":"beforeWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cumulativeDailyMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentDay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decommission","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"minDailyValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes4","name":"selector","type":"bytes4"}],"name":"removeTargetSighash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"sweep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes4","name":"selector","type":"bytes4"}],"name":"targetSighashAllowed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

Deployed Bytecode

0x6080604081815260049182361015610015575f80fd5b5f92833560e01c91826301871a8314610fb55750816301ffc9a714610f2c578163162146fb146104425781632f40e5b8146104425781633280648e14610d4c57816334d184ae146104425781635c9302c914610d2d57816361e8781114610c07578163683acef014610bc95781636ea056a9146109cf578163715018a61461096057816379ba50971461087c5781637f068c0f146107fd5781638da5cb5b146107d7578163a0e38c811461045a578163b998927514610442578163bfd31dc414610423578163d20fb647146103e8578163e30c3978146103c0578163e87b3abe146102dc578163e8ae44aa146102be578163f2fde38b14610149575063fbfa77cf1461011f575f80fd5b346101455781600319360112610145576020906001600160a01b03600254169051908152f35b5080fd5b919050346102ba5760203660031901126102ba5761016561101a565b9161016e611285565b6001600160a01b039182806002541694169380851461029357602083918351928380927f452a93200000000000000000000000000000000000000000000000000000000082525afa908115610289579084918791610248575b501684146102225750506101d9611285565b8173ffffffffffffffffffffffffffffffffffffffff1960015416176001558254167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e227008380a380f35b517f148ae302000000000000000000000000000000000000000000000000000000008152fd5b9150506020813d8211610281575b816102636020938361107b565b8101031261027d5751838116810361027d5783905f6101c7565b8580fd5b3d9150610256565b82513d88823e3d90fd5b50517fa0f15dc6000000000000000000000000000000000000000000000000000000008152fd5b8280fd5b9050346102ba57826003193601126102ba5760209250549051908152f35b9050346102ba57816003193601126102ba576102f661101a565b916102ff611034565b91610308611285565b606084901b6bffffffffffffffffffffffff191660a084901c6bffffffff0000000000000000161790818652600560205260ff8387205416156103925750845260056020528320805460ff191690556001600160e01b031916906001600160a01b03167f566a9a4fba10e4534371d2ea973f09830a90304a10e2a8fce319764158f9e55c8380a380f35b9060249251917ff0d5987a000000000000000000000000000000000000000000000000000000008352820152fd5b5050346101455781600319360112610145576020906001600160a01b03600154169051908152f35b505034610145578160031936011261014557602090517f0000000000000000000000000000000000000000000000000d7621dc582100008152f35b833461043f578060031936011261043f5761043c6111a4565b80f35b80fd5b833461043f576104513661109d565b5061043c6111a4565b9050346102ba5761046a36611157565b926001600160a01b038060025416908133036107c857845462015180420490600654801580156106a7575b505050806003540361069e575b5086600655865b8681106104b4578780f35b6104cb6104c28289886111c9565b858101906111ff565b8711610670576001600160e01b03199035167f095ea7b3000000000000000000000000000000000000000000000000000000008114908115610674575b50610519575b600101955b956104a9565b6105276104c28289886111c9565b80881161066c57810181900360031901851361067057868101359083821680920361066c5760240135156106625782610569610564848b8a6111c9565b611232565b16908486517fdd62ed3e0000000000000000000000000000000000000000000000000000000081528981806105be86602096879584019060209093929360408301946001600160a01b03809216845216910152565b0381875afa918215610658578c92610626575b50506105de57505061050e565b85517f715879af0000000000000000000000000000000000000000000000000000000081526001600160a01b0392831689820190815291909216602082015281900360400190fd5b90809250813d8311610651575b61063d818361107b565b8101031261064d57515f806105d1565b8a80fd5b503d610633565b88513d8e823e3d90fd5b5060010195610513565b8980fd5b8880fd5b7f39509351000000000000000000000000000000000000000000000000000000009150145f610508565b6003555f6104a2565b60035484036107b95782905b875191633fa4f24560e01b83526020838c818b5afa9283156107af578d93610778575b50828102928184041490151715610765576107525704907f0000000000000000000000000000000000000000000000000d7621dc58210000821061072a578103610722575b8080610495565b86555f61071b565b8786517f47968522000000000000000000000000000000000000000000000000000000008152fd5b60248b60128b634e487b7160e01b835252fd5b60248c60118c634e487b7160e01b835252fd5b9092506020813d82116107a7575b816107936020938361107b565b810103126107a35751915f6106d6565b8c80fd5b3d9150610786565b89513d8f823e3d90fd5b670de0b6b3a7640000906106b3565b84835163152df05f60e11b8152fd5b5050346101455781600319360112610145576001600160a01b0360209254169051908152f35b838334610145578160031936011261014557600254906001600160a01b038216330361086d57509173ffffffffffffffffffffffffffffffffffffffff1982931660025581600355557f4bd04f3440c9bf56a25f7b9e1ac75a9803bd83123a127cf9748129c938630b398180a180f35b83905163152df05f60e11b8152fd5b919050346102ba57826003193601126102ba57600154916001600160a01b039133838516036108f757505073ffffffffffffffffffffffffffffffffffffffff19809216600155825491339083161783553391167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b906020608492519162461bcd60e51b8352820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f74207468652060448201527f6e6577206f776e657200000000000000000000000000000000000000000000006064820152fd5b833461043f578060031936011261043f57610979611285565b806001600160a01b0373ffffffffffffffffffffffffffffffffffffffff19806001541660015582549081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b839150346101455782600319360112610145576109ea61101a565b602435916109f6611285565b6001600160a01b03821680610a66575050610a6083948480807fab2246061d7b0dd3631d037e3f6da75782ae489eeb9f6af878a4b25df9b07c779787335af150610a3e611246565b505b5192839283602090939291936001600160a01b0360408201951681520152565b0390a180f35b85517fa9059cbb0000000000000000000000000000000000000000000000000000000060208083019182523360248401526044808401889052835292610afe929188908190610ab660648661107b565b8b5194610ac28661104b565b8786527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656488870152519082855af1610af8611246565b916112dc565b8051828115918215610ba9575b5050905015610b41575050610a607fab2246061d7b0dd3631d037e3f6da75782ae489eeb9f6af878a4b25df9b07c779394610a40565b6084925085519162461bcd60e51b8352820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b838092935001031261027d57810151801515810361027d57808289610b0b565b8383346101455781600319360112610145576001600160a01b03600254163303610bf857508091816003555580f35b90505163152df05f60e11b8152fd5b9050346102ba57816003193601126102ba57610c2161101a565b91610c2a611034565b91610c33611285565b833b15610cf457606084901b6bffffffffffffffffffffffff191660a084901c6bffffffff0000000000000000161790818652600560205260ff8387205416610cc65750845260056020528320805460ff191660011790556001600160e01b031916906001600160a01b03167fa10f2fe4b8a71df10b600a159be010c92558175741cec420c971a463470f04ef8380a380f35b9060249251917f4f9fc2a0000000000000000000000000000000000000000000000000000000008352820152fd5b83906001600160a01b0360249351927fd373ef060000000000000000000000000000000000000000000000000000000084521690820152fd5b5050346101455781600319360112610145576020906003549051908152f35b9050346102ba57610d5c36611157565b6001600160a01b0391826002541692833303610f1d57865b838110610de45750505050602090835192838092633fa4f24560e01b82525afa918215610ddb57508291610daa575b5060065580f35b90506020813d8211610dd3575b81610dc46020938361107b565b8101031261014557515f610da3565b3d9150610db7565b513d84823e3d90fd5b610dfb610df28286866111c9565b888101906111ff565b8711610670576001600160e01b0319610e48913516610e1e6105648488886111c9565b60601b6bffffffffffffffffffffffff191660a09190911c6bffffffff0000000000000000161790565b885260206005815260ff888a20541615610e655750600101610d74565b869288610e748b9488886111c9565b91838251967fc1c440aa0000000000000000000000000000000000000000000000000000000088528701528235908116809103610f19576024860152828201356044860152810135601e1982360301811215610f15570190813591019167ffffffffffffffff821161043f57813603831361043f57908391606060648401528160848401528160a49485850137828201840152601f01601f19168101030190fd5b8380fd5b8480fd5b84865163152df05f60e11b8152fd5b9050346102ba5760203660031901126102ba5735906001600160e01b031982168092036102ba57602092507f755e7563000000000000000000000000000000000000000000000000000000008214918215610f8b575b50519015158152f35b7f01ffc9a7000000000000000000000000000000000000000000000000000000001491505f610f82565b849084346102ba57806003193601126102ba5760ff9060209361100b610fd961101a565b610fe1611034565b6bffffffff00000000000000009060a01c16906bffffffffffffffffffffffff199060601b161790565b81526005855220541615158152f35b600435906001600160a01b038216820361103057565b5f80fd5b602435906001600160e01b03198216820361103057565b6040810190811067ffffffffffffffff82111761106757604052565b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff82111761106757604052565b6020806003198301126110305760043567ffffffffffffffff918282116110305783602383011215611030578160040135928311611067576040928351946110ea838360051b018761107b565b81865260248387019260061b8501019381851161103057602401915b8483106111165750505050505090565b85838303126110305785519061112b8261104b565b8335906001600160a01b0382168203611030578286928994528286013583820152815201920191611106565b9060206003198301126110305760043567ffffffffffffffff9283821161103057806023830112156110305781600401359384116110305760248460051b83010111611030576024019190565b6001600160a01b036002541633036111b857565b600460405163152df05f60e11b8152fd5b91908110156111eb5760051b81013590605e1981360301821215611030570190565b634e487b7160e01b5f52603260045260245ffd5b903590601e1981360301821215611030570180359067ffffffffffffffff82116110305760200191813603831361103057565b356001600160a01b03811681036110305790565b3d15611280573d9067ffffffffffffffff82116110675760405191611275601f8201601f19166020018461107b565b82523d5f602084013e565b606090565b6001600160a01b035f5416330361129857565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b9192901561133d57508151156112f0575090565b3b156112f95790565b606460405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b8251909150156113505750805190602001fd5b6040519062461bcd60e51b82528160208060048301528251908160248401525f935b828510611394575050604492505f838284010152601f80199101168101030190fd5b848101820151868601604401529381019385935061137256fea2646970667358221220a6f9c05c46cf1c4c4f1c91f80cd95902f2287cbb8736b0d2e8c1cd8d6980520f64736f6c63430008150033

Deployed Bytecode Sourcemap

680:13149:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1448:20:0;680:13149;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;680:13149:0;;;;;;:::i;:::-;1090:65:15;;;:::i;:::-;-1:-1:-1;;;;;680:13149:0;;;13721:5;680:13149;;;;13261:16;;;;13257:79;;680:13149;;;;;13365:25;;;;680:13149;13365:25;;;;;;;;;;;;;;;;680:13149;;;13404:18;;13400:84;;1090:65:15;;;;:::i;:::-;680:13149:0;-1:-1:-1;;1228:24:16;680:13149:0;;;1228:24:16;680:13149:0;;;;1267:43:16;;;;680:13149:0;;13400:84;680:13149;13445:28;;;;13365:25;;;;680:13149;13365:25;;;;;;;;;680:13149;13365:25;;;:::i;:::-;;;680:13149;;;;;;;;;;;;13365:25;;;;;680:13149;;;;13365:25;;;-1:-1:-1;13365:25:0;;;680:13149;;;;;;;;;13257:79;680:13149;;13300:25;;;;680:13149;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;:::i;:::-;1090:65:15;;;:::i;:::-;680:13149:0;;;;-1:-1:-1;;680:13149:0;678:6:3;680:13149:0;;;;;637:49:3;680:13149:0;;;;6005:21;680:13149;;;;;;;;6004:37;6000:128;;-1:-1:-1;680:13149:0;;6005:21;680:13149;;;;;;-1:-1:-1;;680:13149:0;;;-1:-1:-1;;;;;;680:13149:0;;-1:-1:-1;;;;;680:13149:0;6299:38;680:13149;;6299:38;680:13149;;6000:128;680:13149;;;;6064:53;;;;;;680:13149;6064:53;680:13149;;;;;;;;;;;;;;;;-1:-1:-1;;;;;926:13:16;680:13149:0;;;;;;;;;;;;;;;;;;;;;;;;;1340:38;680:13149;;;;;;;;;;;;;;;;10380:56;;:::i;:::-;680:13149;;;;;;;;;;;;;:::i;:::-;;;;:::i;:::-;;;;;;;;;:::i;:::-;;-1:-1:-1;;;;;680:13149:0;2787:5;680:13149;;2773:10;;;:19;2769:81;;680:13149;;8164:6;8146:15;680:13149;;8185:12;680:13149;8185:16;;;;8181:679;;680:13149;;;;;8937:10;680:13149;8937:17;8933:64;;680:13149;;;8185:12;680:13149;9347:13;9362:17;;;;;;680:13149;;;9347:13;9414:18;:13;;;;;:::i;:::-;:18;;;;;:::i;:::-;680:13149;;;;-1:-1:-1;;;;;;680:13149:0;;;12914:23;12902:35;;:113;;;;;9347:13;9452:805;;;9347:13;680:13149;;9347:13;;;;;9452:805;9635:18;:13;;;;;:::i;:18::-;680:13149;;;;;9624:54;;211:4:1;;;-1:-1:-1;;211:4:1;;-1:-1:-1;211:4:1;;680:13149:0;;;211:4:1;680:13149:0;;;;;;;;;211:4:1;;680:13149:0;9773:11;9769:164;;9966:13;:20;:13;;;;;:::i;:::-;:20;:::i;:::-;680:13149;;;;;;10109:31;;211:4:1;;;10109:31:0;211:4:1;;10109:31:0;;;;;211:4:1;;;;;;;;;680:13149:0;-1:-1:-1;;;;;680:13149:0;;;;;;211:4:1;;680:13149:0;211:4:1;10109:31:0;;;;;;;;;;;;;;;9452:805;10109:35;;10105:138;;9452:805;;;;10105:138;680:13149;;10175:49;;;-1:-1:-1;;;;;680:13149:0;;;10175:49;;;680:13149;;;;;;;211:4:1;;;680:13149:0;10175:49;;;211:4:1;10175:49:0;;;10109:31;;;;;;;;;;;;;;;;:::i;:::-;;;680:13149;;;;;10109:31;;;;680:13149;;;;10109:31;;;;;;680:13149;;;;;;;;;9769:164;680:13149;;;9906:8;;;680:13149;;;;211:4:1;680:13149:0;;;12902:113;12965:50;12953:62;;;12902:113;;;8933:64;8937:10;680:13149;8933:64;;;8181:679;8321:10;680:13149;8321:17;;:43;;;;;680:13149;;8427:21;-1:-1:-1;;;8427:21:0;;;;;;;;;;;;;;;;;;8321:43;211:4:1;;;;;;;;;;;;;;;680:13149:0;;;8578:13;;8562:29;;8558:111;;8740:34;;8736:114;;8321:43;8181:679;;;;8736:114;680:13149;;8736:114;;;8558:111;680:13149;;;8618:36;;;;680:13149;;;;;-1:-1:-1;;;680:13149:0;;;;211:4:1;680:13149:0;;;;-1:-1:-1;;;680:13149:0;;;;8427:21;;;;;;;;;;;;;;;;;;:::i;:::-;;;680:13149;;;;;8427:21;;;;680:13149;;;;8427:21;;;-1:-1:-1;8427:21:0;;;680:13149;;;;;;;;;8321:43;211:4:1;8321:43:0;;;2769:81;680:13149;;;-1:-1:-1;;;2815:24:0;;;680:13149;;;;;;;;;;;;;;-1:-1:-1;;;;;680:13149:0;;;;;;;;;;;;;;;;;;;;;;;;2787:5;680:13149;;-1:-1:-1;;;;;680:13149:0;;2773:10;:19;2769:81;;680:13149;;-1:-1:-1;;680:13149:0;;;2787:5;680:13149;;10829:14;680:13149;;10930:16;;;;680:13149;;2769:81;680:13149;;;-1:-1:-1;;;2815:24:0;;;680:13149;;;;;;;;;;;;;;;926:13:16;680:13149:0;;-1:-1:-1;;;;;736:10:9;;680:13149:0;;;1833:24:16;680:13149:0;;;;-1:-1:-1;;680:13149:0;;;926:13:16;680:13149:0;;;736:10:9;;680:13149:0;;;;;;736:10:9;680:13149:0;;2639:40:15;;;;680:13149:0;;;;;;;;;-1:-1:-1;;;680:13149:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1090:65:15;;:::i;:::-;680:13149:0;-1:-1:-1;;;;;;;680:13149:0;1583:20:16;680:13149:0;;1583:20:16;680:13149:0;;;;;;;;;2639:40:15;;;;680:13149:0;;;;;;;;;;;;;;;;;;;:::i;:::-;;;1090:65:15;;;:::i;:::-;-1:-1:-1;;;;;680:13149:0;;548:19:2;680:13149:0;;583:10:2;;720:20;583:10;;;;;720:20;583:10;;;:34;;;;;:::i;:::-;;544:161;680:13149:0;720:20:2;;;;680:13149:0;;;;;;-1:-1:-1;;;;;680:13149:0;;;;;;;;;;720:20:2;;;;680:13149:0;;544:161:2;680:13149:0;;;;1050:58:17;;;;;;675:10:2;680:13149:0;1050:58:17;;680:13149:0;;;;;;;;1050:58:17;;680:13149:0;5670:69:8;;680:13149:0;1050:58:17;;;;;680:13149:0;;1050:58:17;:::i;:::-;680:13149:0;;;;;;:::i;:::-;;;;;;;;;5621:31:8;;;;;;;;:::i;:::-;5670:69;;:::i;:::-;680:13149:0;;5801:22:17;;;:56;;;;;544:161:2;680:13149:0;;;;;;;544:161:2;;720:20;;544:161;;;;680:13149:0;;;;;;;-1:-1:-1;;;680:13149:0;;;;;;;;;;;;;;;;;;;;;5801:56:17;5827:30;;;;;;680:13149:0;;;;5827:30:17;;680:13149:0;;;;;;;;5801:56:17;;;;;680:13149:0;;;;;;;;;;;;;;-1:-1:-1;;;;;2787:5:0;680:13149;;2773:10;:19;2769:81;;680:13149;;;;10568:14;680:13149;;;;2769:81;680:13149;;;-1:-1:-1;;;2815:24:0;;;680:13149;;;;;;;;;;;;;;;;:::i;:::-;;;;:::i;:::-;1090:65:15;;;:::i;:::-;11937:18:0;;:23;11933:89;;680:13149;;;;-1:-1:-1;;680:13149:0;678:6:3;680:13149:0;;;;;637:49:3;680:13149:0;;;;12210:21;680:13149;;;;;;;;12206:123;;-1:-1:-1;680:13149:0;;12210:21;680:13149;;;;;;-1:-1:-1;;680:13149:0;12447:4;680:13149;;;-1:-1:-1;;;;;;680:13149:0;;-1:-1:-1;;;;;680:13149:0;12496:36;680:13149;;12496:36;680:13149;;12206:123;680:13149;;;;12269:49;;;;;;680:13149;12269:49;11933:89;680:13149;;-1:-1:-1;;;;;680:13149:0;;;11983:28;;;;680:13149;11983:28;;;680:13149;11983:28;680:13149;;;;;;;;;;;;;;;;1510:25;680:13149;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;680:13149:0;;2787:5;680:13149;;2773:10;;;:19;2769:81;;7219:13;7234:17;;;;;;680:13149;;;;;;;;7857:21;;;;-1:-1:-1;;;7857:21:0;;;;;;;;;;;;;;7214:529;680:13149;7842:36;680:13149;;;7857:21;;;680:13149;7857:21;;;;;;;;;680:13149;7857:21;;;:::i;:::-;;;680:13149;;;;;7857:21;;;;;;-1:-1:-1;7857:21:0;;;680:13149;;;;;;;;7219:13;7286:18;:13;;;;;:::i;:::-;:18;;;;;:::i;:::-;680:13149;;;;-1:-1:-1;;;;;;7349:94:0;680:13149;;;7399:20;:13;;;;;:::i;:20::-;680:13149;;-1:-1:-1;;680:13149:0;678:6:3;680:13149:0;;;;;;637:49:3;;447:256;7349:94:0;680:13149;;;7549:21;680:13149;;;;;;;;7548:31;7544:114;;680:13149;;;7219:13;;7544:114;7629:13;;;;;;;;;:::i;:::-;680:13149;;;;7606:37;;;;;;680:13149;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;680:13149:0;;;7606:37;;;;680:13149;;;;;;;;2769:81;680:13149;;;-1:-1:-1;;;2815:24:0;;;680:13149;;;;;;;;-1:-1:-1;;680:13149:0;;;;;;-1:-1:-1;;;;;;680:13149:0;;;;;;;;11123:39;;11138:24;11123:39;;:91;;;;;680:13149;;;;;;;;;11123:91;978:25:10;963:40;;-1:-1:-1;11123:91:0;;;680:13149;;;;;;;;;;;;;;;;;;;11540:72;680:13149;;:::i;:::-;;;:::i;:::-;;447:256:3;678:6;680:13149:0;;;;;;;;;637:49:3;447:256;;11540:72:0;680:13149;;11518:21;680:13149;;;;;;;;;;;;;;-1:-1:-1;;;;;680:13149:0;;;;;;:::o;:::-;;;;;;;;-1:-1:-1;;;;;;680:13149:0;;;;;;:::o;:::-;;;;;;;;;;;;;;;:::o;:::-;-1:-1:-1;;;680:13149:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;:::i;:::-;;;;-1:-1:-1;;;;;680:13149:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;680:13149:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;2738:129::-;-1:-1:-1;;;;;2787:5:0;680:13149;;2773:10;:19;2769:81;;2738:129::o;2769:81::-;2815:24;680:13149;;-1:-1:-1;;;2815:24:0;;;680:13149;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;-1:-1:-1;;;680:13149:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;-1:-1:-1;;;;;680:13149:0;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;-1:-1:-1;;680:13149:0;;;;;:::i;:::-;;;;-1:-1:-1;680:13149:0;;;;:::o;:::-;;;:::o;1401:132:15:-;-1:-1:-1;;;;;1309:6:15;680:13149:0;;736:10:9;1465:23:15;680:13149:0;;1401:132:15:o;680:13149:0:-;;;;-1:-1:-1;;;680:13149:0;;;;;;;;;;;;;;;;;;7865:644:8;;;;8075:427;;;680:13149:0;;;8107:22:8;8103:290;;8407:17;;:::o;8103:290::-;1746:19;:23;680:13149:0;;8407:17:8;:::o;680:13149:0:-;;;;-1:-1:-1;;;680:13149:0;;;;;;;;;;;;;;;;;;8075:427:8;680:13149:0;;;;-1:-1:-1;9212:21:8;:17;;9387:145;;;;;;;9208:388;680:13149:0;;9564:20:8;-1:-1:-1;;;9564:20:8;;680:13149:0;;9564:20:8;;;;680:13149:0;;;;;;;;;9232:1:8;680:13149:0;;;;;;;;;;;;9232:1:8;680:13149:0;;;;;;;;;;;;;;9564:20:8;;;;680:13149:0;;;;;;;;;;;;;;;;;;;-1:-1:-1;680:13149:0;

Swarm Source

ipfs://a6f9c05c46cf1c4c4f1c91f80cd95902f2287cbb8736b0d2e8c1cd8d6980520f

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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