ETH Price: $3,783.92 (+1.21%)
Gas: 4 Gwei

Contract

0xa1b23fc4Acd88107dE77D6dB0310DCC77C385D76
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Wrap And Add To ...199863622024-05-31 0:54:1129 hrs ago1717116851IN
0xa1b23fc4...77C385D76
0 ETH0.001529176.34739925
Wrap And Add To ...199391532024-05-24 10:29:477 days ago1716546587IN
0xa1b23fc4...77C385D76
0 ETH0.001565226.55493695
Wrap And Add To ...199342192024-05-23 17:57:598 days ago1716487079IN
0xa1b23fc4...77C385D76
0 ETH0.0028224411.73313625
Wrap And Add To ...199040522024-05-19 12:42:3512 days ago1716122555IN
0xa1b23fc4...77C385D76
0 ETH0.000236982.96313554
Wrap And Add To ...199040022024-05-19 12:32:3512 days ago1716121955IN
0xa1b23fc4...77C385D76
0 ETH0.000267173.34551691
Wrap And Add To ...198878202024-05-17 6:10:3514 days ago1715926235IN
0xa1b23fc4...77C385D76
0 ETH0.000830933.38670076
Wrap And Add To ...198878122024-05-17 6:08:5914 days ago1715926139IN
0xa1b23fc4...77C385D76
0 ETH0.000281253.5217929
Wrap And Add To ...198877892024-05-17 6:04:2315 days ago1715925863IN
0xa1b23fc4...77C385D76
0 ETH0.000287173.59592572
Wrap And Add To ...198877752024-05-17 6:01:3515 days ago1715925695IN
0xa1b23fc4...77C385D76
0 ETH0.000298593.73899557
Wrap And Add To ...198862242024-05-17 0:49:4715 days ago1715906987IN
0xa1b23fc4...77C385D76
0 ETH0.000726433.01983445
Wrap And Add To ...198684432024-05-14 13:09:2317 days ago1715692163IN
0xa1b23fc4...77C385D76
0 ETH0.0027771311.54422046
Wrap And Add To ...198657882024-05-14 4:12:4718 days ago1715659967IN
0xa1b23fc4...77C385D76
0 ETH0.00088813.61969843
Wrap And Add To ...198656832024-05-14 3:51:2318 days ago1715658683IN
0xa1b23fc4...77C385D76
0 ETH0.001010324.2
Wrap And Add To ...198615472024-05-13 13:59:2318 days ago1715608763IN
0xa1b23fc4...77C385D76
0 ETH0.0037926815.76575953
Wrap And Add To ...198517562024-05-12 5:07:5920 days ago1715490479IN
0xa1b23fc4...77C385D76
0 ETH0.000857523.65941395
Wrap And Add To ...197760072024-05-01 14:54:4730 days ago1714575287IN
0xa1b23fc4...77C385D76
0 ETH0.0025250210.36610041
Wrap And Add To ...197760032024-05-01 14:53:5930 days ago1714575239IN
0xa1b23fc4...77C385D76
0 ETH0.0008800311.02370385
Wrap And Add To ...197760002024-05-01 14:53:2330 days ago1714575203IN
0xa1b23fc4...77C385D76
0 ETH0.0008274310.36485356
Wrap And Add To ...197759942024-05-01 14:52:1130 days ago1714575131IN
0xa1b23fc4...77C385D76
0 ETH0.0008853811.09074784
Wrap And Add To ...197759892024-05-01 14:51:1130 days ago1714575071IN
0xa1b23fc4...77C385D76
0 ETH0.0008407110.53124212
Wrap And Add To ...197759862024-05-01 14:50:3530 days ago1714575035IN
0xa1b23fc4...77C385D76
0 ETH0.0008310510.41021916
Wrap And Add To ...197759832024-05-01 14:49:5930 days ago1714574999IN
0xa1b23fc4...77C385D76
0 ETH0.0008160810.22267992
Wrap And Add To ...197759802024-05-01 14:49:2330 days ago1714574963IN
0xa1b23fc4...77C385D76
0 ETH0.0008259510.34632543
Wrap And Add To ...197759752024-05-01 14:48:2330 days ago1714574903IN
0xa1b23fc4...77C385D76
0 ETH0.0008070810.1098748
Wrap And Add To ...197759732024-05-01 14:47:5930 days ago1714574879IN
0xa1b23fc4...77C385D76
0 ETH0.000782349.79998842
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
StETHWrappingProxy

Compiler Version
v0.8.24+commit.e11b9ed9

Optimization Enabled:
Yes with 200 runs

Other Settings:
shanghai EvmVersion, BSL 1.1 license
File 1 of 31 : StETHWrappingProxy.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.8.24;

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

import { DCS_STRATEGY_ID, FCN_STRATEGY_ID } from "../Structs.sol";
import { Errors } from "../utils/Errors.sol";
import { IDCSEntry } from "../cega-strategies/dcs/interfaces/IDCSEntry.sol";
import { IFCNEntry } from "../cega-strategies/fcn/interfaces/IFCNEntry.sol";
import { IProductViewEntry } from "../common/interfaces/IProductViewEntry.sol";
import { IWrappingProxy } from "./interfaces/IWrappingProxy.sol";
import { IWstETH } from "./interfaces/IWstETH.sol";

contract StETHWrappingProxy is IWrappingProxy {
    using SafeCast for uint256;

    address public immutable cegaEntry;

    IERC20 public immutable stETH;

    IWstETH public immutable wstETH;

    constructor(address _cegaEntry, IERC20 _stETH, IWstETH _wstETH) {
        cegaEntry = _cegaEntry;
        stETH = _stETH;
        wstETH = _wstETH;

        // stETH and wstETH support infinite approval, so it's enough to approve once
        _stETH.approve(address(_wstETH), type(uint256).max);
        _wstETH.approve(_cegaEntry, type(uint256).max);
    }

    function unwrapAndTransfer(address receiver, uint256 amount) external {
        uint256 stETHAmount = wstETH.unwrap(amount);
        stETH.transfer(receiver, stETHAmount);
    }

    function wrapAndAddToDCSDepositQueue(
        uint32 productId,
        uint128 amount,
        address receiver
    ) public {
        _wrapAndAddToDCSDepositQueue(productId, amount, receiver);
    }

    function wrapAndAddToFCNDepositQueue(
        uint32 productId,
        uint128 amount,
        address receiver
    ) public {
        _wrapAndAddToFCNDepositQueue(productId, amount, receiver);
    }

    function wrapAndAddToDepositQueue(
        uint32 productId,
        uint128 amount,
        address receiver
    ) external {
        uint32 strategyId = IProductViewEntry(cegaEntry).getStrategyOfProduct(
            productId
        );

        if (strategyId == DCS_STRATEGY_ID) {
            _wrapAndAddToDCSDepositQueue(productId, amount, receiver);
        } else if (strategyId == FCN_STRATEGY_ID) {
            _wrapAndAddToFCNDepositQueue(productId, amount, receiver);
        } else {
            revert(Errors.WRONG_STRATEGY);
        }
    }

    function _wrapAndAddToDCSDepositQueue(
        uint32 productId,
        uint128 amount,
        address receiver
    ) internal {
        stETH.transferFrom(msg.sender, address(this), amount);
        uint128 wstETHAmount = wstETH.wrap(amount).toUint128();
        IDCSEntry(cegaEntry).dcsAddToDepositQueue(
            productId,
            wstETHAmount,
            receiver
        );
    }

    function _wrapAndAddToFCNDepositQueue(
        uint32 productId,
        uint128 amount,
        address receiver
    ) internal {
        stETH.transferFrom(msg.sender, address(this), amount);
        uint128 wstETHAmount = wstETH.wrap(amount).toUint128();
        IFCNEntry(cegaEntry).fcnAddToDepositQueue(
            productId,
            wstETHAmount,
            receiver
        );
    }
}

File 2 of 31 : 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 31 : SafeCast.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.

pragma solidity ^0.8.0;

/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 *
 * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
 * all math on `uint256` and `int256` and then downcasting.
 */
library SafeCast {
    /**
     * @dev Returns the downcasted uint248 from uint256, reverting on
     * overflow (when the input is greater than largest uint248).
     *
     * Counterpart to Solidity's `uint248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     *
     * _Available since v4.7._
     */
    function toUint248(uint256 value) internal pure returns (uint248) {
        require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits");
        return uint248(value);
    }

    /**
     * @dev Returns the downcasted uint240 from uint256, reverting on
     * overflow (when the input is greater than largest uint240).
     *
     * Counterpart to Solidity's `uint240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     *
     * _Available since v4.7._
     */
    function toUint240(uint256 value) internal pure returns (uint240) {
        require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits");
        return uint240(value);
    }

    /**
     * @dev Returns the downcasted uint232 from uint256, reverting on
     * overflow (when the input is greater than largest uint232).
     *
     * Counterpart to Solidity's `uint232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     *
     * _Available since v4.7._
     */
    function toUint232(uint256 value) internal pure returns (uint232) {
        require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits");
        return uint232(value);
    }

    /**
     * @dev Returns the downcasted uint224 from uint256, reverting on
     * overflow (when the input is greater than largest uint224).
     *
     * Counterpart to Solidity's `uint224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     *
     * _Available since v4.2._
     */
    function toUint224(uint256 value) internal pure returns (uint224) {
        require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits");
        return uint224(value);
    }

    /**
     * @dev Returns the downcasted uint216 from uint256, reverting on
     * overflow (when the input is greater than largest uint216).
     *
     * Counterpart to Solidity's `uint216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     *
     * _Available since v4.7._
     */
    function toUint216(uint256 value) internal pure returns (uint216) {
        require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits");
        return uint216(value);
    }

    /**
     * @dev Returns the downcasted uint208 from uint256, reverting on
     * overflow (when the input is greater than largest uint208).
     *
     * Counterpart to Solidity's `uint208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     *
     * _Available since v4.7._
     */
    function toUint208(uint256 value) internal pure returns (uint208) {
        require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits");
        return uint208(value);
    }

    /**
     * @dev Returns the downcasted uint200 from uint256, reverting on
     * overflow (when the input is greater than largest uint200).
     *
     * Counterpart to Solidity's `uint200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     *
     * _Available since v4.7._
     */
    function toUint200(uint256 value) internal pure returns (uint200) {
        require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits");
        return uint200(value);
    }

    /**
     * @dev Returns the downcasted uint192 from uint256, reverting on
     * overflow (when the input is greater than largest uint192).
     *
     * Counterpart to Solidity's `uint192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     *
     * _Available since v4.7._
     */
    function toUint192(uint256 value) internal pure returns (uint192) {
        require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits");
        return uint192(value);
    }

    /**
     * @dev Returns the downcasted uint184 from uint256, reverting on
     * overflow (when the input is greater than largest uint184).
     *
     * Counterpart to Solidity's `uint184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     *
     * _Available since v4.7._
     */
    function toUint184(uint256 value) internal pure returns (uint184) {
        require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits");
        return uint184(value);
    }

    /**
     * @dev Returns the downcasted uint176 from uint256, reverting on
     * overflow (when the input is greater than largest uint176).
     *
     * Counterpart to Solidity's `uint176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     *
     * _Available since v4.7._
     */
    function toUint176(uint256 value) internal pure returns (uint176) {
        require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits");
        return uint176(value);
    }

    /**
     * @dev Returns the downcasted uint168 from uint256, reverting on
     * overflow (when the input is greater than largest uint168).
     *
     * Counterpart to Solidity's `uint168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     *
     * _Available since v4.7._
     */
    function toUint168(uint256 value) internal pure returns (uint168) {
        require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits");
        return uint168(value);
    }

    /**
     * @dev Returns the downcasted uint160 from uint256, reverting on
     * overflow (when the input is greater than largest uint160).
     *
     * Counterpart to Solidity's `uint160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     *
     * _Available since v4.7._
     */
    function toUint160(uint256 value) internal pure returns (uint160) {
        require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits");
        return uint160(value);
    }

    /**
     * @dev Returns the downcasted uint152 from uint256, reverting on
     * overflow (when the input is greater than largest uint152).
     *
     * Counterpart to Solidity's `uint152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     *
     * _Available since v4.7._
     */
    function toUint152(uint256 value) internal pure returns (uint152) {
        require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits");
        return uint152(value);
    }

    /**
     * @dev Returns the downcasted uint144 from uint256, reverting on
     * overflow (when the input is greater than largest uint144).
     *
     * Counterpart to Solidity's `uint144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     *
     * _Available since v4.7._
     */
    function toUint144(uint256 value) internal pure returns (uint144) {
        require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits");
        return uint144(value);
    }

    /**
     * @dev Returns the downcasted uint136 from uint256, reverting on
     * overflow (when the input is greater than largest uint136).
     *
     * Counterpart to Solidity's `uint136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     *
     * _Available since v4.7._
     */
    function toUint136(uint256 value) internal pure returns (uint136) {
        require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits");
        return uint136(value);
    }

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v2.5._
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits");
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint120 from uint256, reverting on
     * overflow (when the input is greater than largest uint120).
     *
     * Counterpart to Solidity's `uint120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     *
     * _Available since v4.7._
     */
    function toUint120(uint256 value) internal pure returns (uint120) {
        require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits");
        return uint120(value);
    }

    /**
     * @dev Returns the downcasted uint112 from uint256, reverting on
     * overflow (when the input is greater than largest uint112).
     *
     * Counterpart to Solidity's `uint112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     *
     * _Available since v4.7._
     */
    function toUint112(uint256 value) internal pure returns (uint112) {
        require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits");
        return uint112(value);
    }

    /**
     * @dev Returns the downcasted uint104 from uint256, reverting on
     * overflow (when the input is greater than largest uint104).
     *
     * Counterpart to Solidity's `uint104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     *
     * _Available since v4.7._
     */
    function toUint104(uint256 value) internal pure returns (uint104) {
        require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits");
        return uint104(value);
    }

    /**
     * @dev Returns the downcasted uint96 from uint256, reverting on
     * overflow (when the input is greater than largest uint96).
     *
     * Counterpart to Solidity's `uint96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     *
     * _Available since v4.2._
     */
    function toUint96(uint256 value) internal pure returns (uint96) {
        require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits");
        return uint96(value);
    }

    /**
     * @dev Returns the downcasted uint88 from uint256, reverting on
     * overflow (when the input is greater than largest uint88).
     *
     * Counterpart to Solidity's `uint88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     *
     * _Available since v4.7._
     */
    function toUint88(uint256 value) internal pure returns (uint88) {
        require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits");
        return uint88(value);
    }

    /**
     * @dev Returns the downcasted uint80 from uint256, reverting on
     * overflow (when the input is greater than largest uint80).
     *
     * Counterpart to Solidity's `uint80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     *
     * _Available since v4.7._
     */
    function toUint80(uint256 value) internal pure returns (uint80) {
        require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits");
        return uint80(value);
    }

    /**
     * @dev Returns the downcasted uint72 from uint256, reverting on
     * overflow (when the input is greater than largest uint72).
     *
     * Counterpart to Solidity's `uint72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     *
     * _Available since v4.7._
     */
    function toUint72(uint256 value) internal pure returns (uint72) {
        require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits");
        return uint72(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v2.5._
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits");
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint56 from uint256, reverting on
     * overflow (when the input is greater than largest uint56).
     *
     * Counterpart to Solidity's `uint56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     *
     * _Available since v4.7._
     */
    function toUint56(uint256 value) internal pure returns (uint56) {
        require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits");
        return uint56(value);
    }

    /**
     * @dev Returns the downcasted uint48 from uint256, reverting on
     * overflow (when the input is greater than largest uint48).
     *
     * Counterpart to Solidity's `uint48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     *
     * _Available since v4.7._
     */
    function toUint48(uint256 value) internal pure returns (uint48) {
        require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits");
        return uint48(value);
    }

    /**
     * @dev Returns the downcasted uint40 from uint256, reverting on
     * overflow (when the input is greater than largest uint40).
     *
     * Counterpart to Solidity's `uint40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     *
     * _Available since v4.7._
     */
    function toUint40(uint256 value) internal pure returns (uint40) {
        require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits");
        return uint40(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v2.5._
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits");
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint24 from uint256, reverting on
     * overflow (when the input is greater than largest uint24).
     *
     * Counterpart to Solidity's `uint24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     *
     * _Available since v4.7._
     */
    function toUint24(uint256 value) internal pure returns (uint24) {
        require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits");
        return uint24(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v2.5._
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits");
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     *
     * _Available since v2.5._
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits");
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     *
     * _Available since v3.0._
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        require(value >= 0, "SafeCast: value must be positive");
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int248 from int256, reverting on
     * overflow (when the input is less than smallest int248 or
     * greater than largest int248).
     *
     * Counterpart to Solidity's `int248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     *
     * _Available since v4.7._
     */
    function toInt248(int256 value) internal pure returns (int248 downcasted) {
        downcasted = int248(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 248 bits");
    }

    /**
     * @dev Returns the downcasted int240 from int256, reverting on
     * overflow (when the input is less than smallest int240 or
     * greater than largest int240).
     *
     * Counterpart to Solidity's `int240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     *
     * _Available since v4.7._
     */
    function toInt240(int256 value) internal pure returns (int240 downcasted) {
        downcasted = int240(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 240 bits");
    }

    /**
     * @dev Returns the downcasted int232 from int256, reverting on
     * overflow (when the input is less than smallest int232 or
     * greater than largest int232).
     *
     * Counterpart to Solidity's `int232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     *
     * _Available since v4.7._
     */
    function toInt232(int256 value) internal pure returns (int232 downcasted) {
        downcasted = int232(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 232 bits");
    }

    /**
     * @dev Returns the downcasted int224 from int256, reverting on
     * overflow (when the input is less than smallest int224 or
     * greater than largest int224).
     *
     * Counterpart to Solidity's `int224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     *
     * _Available since v4.7._
     */
    function toInt224(int256 value) internal pure returns (int224 downcasted) {
        downcasted = int224(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 224 bits");
    }

    /**
     * @dev Returns the downcasted int216 from int256, reverting on
     * overflow (when the input is less than smallest int216 or
     * greater than largest int216).
     *
     * Counterpart to Solidity's `int216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     *
     * _Available since v4.7._
     */
    function toInt216(int256 value) internal pure returns (int216 downcasted) {
        downcasted = int216(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 216 bits");
    }

    /**
     * @dev Returns the downcasted int208 from int256, reverting on
     * overflow (when the input is less than smallest int208 or
     * greater than largest int208).
     *
     * Counterpart to Solidity's `int208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     *
     * _Available since v4.7._
     */
    function toInt208(int256 value) internal pure returns (int208 downcasted) {
        downcasted = int208(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 208 bits");
    }

    /**
     * @dev Returns the downcasted int200 from int256, reverting on
     * overflow (when the input is less than smallest int200 or
     * greater than largest int200).
     *
     * Counterpart to Solidity's `int200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     *
     * _Available since v4.7._
     */
    function toInt200(int256 value) internal pure returns (int200 downcasted) {
        downcasted = int200(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 200 bits");
    }

    /**
     * @dev Returns the downcasted int192 from int256, reverting on
     * overflow (when the input is less than smallest int192 or
     * greater than largest int192).
     *
     * Counterpart to Solidity's `int192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     *
     * _Available since v4.7._
     */
    function toInt192(int256 value) internal pure returns (int192 downcasted) {
        downcasted = int192(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 192 bits");
    }

    /**
     * @dev Returns the downcasted int184 from int256, reverting on
     * overflow (when the input is less than smallest int184 or
     * greater than largest int184).
     *
     * Counterpart to Solidity's `int184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     *
     * _Available since v4.7._
     */
    function toInt184(int256 value) internal pure returns (int184 downcasted) {
        downcasted = int184(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 184 bits");
    }

    /**
     * @dev Returns the downcasted int176 from int256, reverting on
     * overflow (when the input is less than smallest int176 or
     * greater than largest int176).
     *
     * Counterpart to Solidity's `int176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     *
     * _Available since v4.7._
     */
    function toInt176(int256 value) internal pure returns (int176 downcasted) {
        downcasted = int176(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 176 bits");
    }

    /**
     * @dev Returns the downcasted int168 from int256, reverting on
     * overflow (when the input is less than smallest int168 or
     * greater than largest int168).
     *
     * Counterpart to Solidity's `int168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     *
     * _Available since v4.7._
     */
    function toInt168(int256 value) internal pure returns (int168 downcasted) {
        downcasted = int168(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 168 bits");
    }

    /**
     * @dev Returns the downcasted int160 from int256, reverting on
     * overflow (when the input is less than smallest int160 or
     * greater than largest int160).
     *
     * Counterpart to Solidity's `int160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     *
     * _Available since v4.7._
     */
    function toInt160(int256 value) internal pure returns (int160 downcasted) {
        downcasted = int160(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 160 bits");
    }

    /**
     * @dev Returns the downcasted int152 from int256, reverting on
     * overflow (when the input is less than smallest int152 or
     * greater than largest int152).
     *
     * Counterpart to Solidity's `int152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     *
     * _Available since v4.7._
     */
    function toInt152(int256 value) internal pure returns (int152 downcasted) {
        downcasted = int152(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 152 bits");
    }

    /**
     * @dev Returns the downcasted int144 from int256, reverting on
     * overflow (when the input is less than smallest int144 or
     * greater than largest int144).
     *
     * Counterpart to Solidity's `int144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     *
     * _Available since v4.7._
     */
    function toInt144(int256 value) internal pure returns (int144 downcasted) {
        downcasted = int144(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 144 bits");
    }

    /**
     * @dev Returns the downcasted int136 from int256, reverting on
     * overflow (when the input is less than smallest int136 or
     * greater than largest int136).
     *
     * Counterpart to Solidity's `int136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     *
     * _Available since v4.7._
     */
    function toInt136(int256 value) internal pure returns (int136 downcasted) {
        downcasted = int136(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 136 bits");
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v3.1._
     */
    function toInt128(int256 value) internal pure returns (int128 downcasted) {
        downcasted = int128(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 128 bits");
    }

    /**
     * @dev Returns the downcasted int120 from int256, reverting on
     * overflow (when the input is less than smallest int120 or
     * greater than largest int120).
     *
     * Counterpart to Solidity's `int120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     *
     * _Available since v4.7._
     */
    function toInt120(int256 value) internal pure returns (int120 downcasted) {
        downcasted = int120(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 120 bits");
    }

    /**
     * @dev Returns the downcasted int112 from int256, reverting on
     * overflow (when the input is less than smallest int112 or
     * greater than largest int112).
     *
     * Counterpart to Solidity's `int112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     *
     * _Available since v4.7._
     */
    function toInt112(int256 value) internal pure returns (int112 downcasted) {
        downcasted = int112(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 112 bits");
    }

    /**
     * @dev Returns the downcasted int104 from int256, reverting on
     * overflow (when the input is less than smallest int104 or
     * greater than largest int104).
     *
     * Counterpart to Solidity's `int104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     *
     * _Available since v4.7._
     */
    function toInt104(int256 value) internal pure returns (int104 downcasted) {
        downcasted = int104(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 104 bits");
    }

    /**
     * @dev Returns the downcasted int96 from int256, reverting on
     * overflow (when the input is less than smallest int96 or
     * greater than largest int96).
     *
     * Counterpart to Solidity's `int96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     *
     * _Available since v4.7._
     */
    function toInt96(int256 value) internal pure returns (int96 downcasted) {
        downcasted = int96(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 96 bits");
    }

    /**
     * @dev Returns the downcasted int88 from int256, reverting on
     * overflow (when the input is less than smallest int88 or
     * greater than largest int88).
     *
     * Counterpart to Solidity's `int88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     *
     * _Available since v4.7._
     */
    function toInt88(int256 value) internal pure returns (int88 downcasted) {
        downcasted = int88(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 88 bits");
    }

    /**
     * @dev Returns the downcasted int80 from int256, reverting on
     * overflow (when the input is less than smallest int80 or
     * greater than largest int80).
     *
     * Counterpart to Solidity's `int80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     *
     * _Available since v4.7._
     */
    function toInt80(int256 value) internal pure returns (int80 downcasted) {
        downcasted = int80(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 80 bits");
    }

    /**
     * @dev Returns the downcasted int72 from int256, reverting on
     * overflow (when the input is less than smallest int72 or
     * greater than largest int72).
     *
     * Counterpart to Solidity's `int72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     *
     * _Available since v4.7._
     */
    function toInt72(int256 value) internal pure returns (int72 downcasted) {
        downcasted = int72(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 72 bits");
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v3.1._
     */
    function toInt64(int256 value) internal pure returns (int64 downcasted) {
        downcasted = int64(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 64 bits");
    }

    /**
     * @dev Returns the downcasted int56 from int256, reverting on
     * overflow (when the input is less than smallest int56 or
     * greater than largest int56).
     *
     * Counterpart to Solidity's `int56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     *
     * _Available since v4.7._
     */
    function toInt56(int256 value) internal pure returns (int56 downcasted) {
        downcasted = int56(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 56 bits");
    }

    /**
     * @dev Returns the downcasted int48 from int256, reverting on
     * overflow (when the input is less than smallest int48 or
     * greater than largest int48).
     *
     * Counterpart to Solidity's `int48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     *
     * _Available since v4.7._
     */
    function toInt48(int256 value) internal pure returns (int48 downcasted) {
        downcasted = int48(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 48 bits");
    }

    /**
     * @dev Returns the downcasted int40 from int256, reverting on
     * overflow (when the input is less than smallest int40 or
     * greater than largest int40).
     *
     * Counterpart to Solidity's `int40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     *
     * _Available since v4.7._
     */
    function toInt40(int256 value) internal pure returns (int40 downcasted) {
        downcasted = int40(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 40 bits");
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v3.1._
     */
    function toInt32(int256 value) internal pure returns (int32 downcasted) {
        downcasted = int32(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 32 bits");
    }

    /**
     * @dev Returns the downcasted int24 from int256, reverting on
     * overflow (when the input is less than smallest int24 or
     * greater than largest int24).
     *
     * Counterpart to Solidity's `int24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     *
     * _Available since v4.7._
     */
    function toInt24(int256 value) internal pure returns (int24 downcasted) {
        downcasted = int24(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 24 bits");
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v3.1._
     */
    function toInt16(int256 value) internal pure returns (int16 downcasted) {
        downcasted = int16(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 16 bits");
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     *
     * _Available since v3.1._
     */
    function toInt8(int256 value) internal pure returns (int8 downcasted) {
        downcasted = int8(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 8 bits");
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     *
     * _Available since v3.0._
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
        require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
        return int256(value);
    }
}

File 4 of 31 : Structs.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.24;

import { DCSProduct, DCSVault } from "./cega-strategies/dcs/DCSStructs.sol";
import { FCNProduct, FCNVault } from "./cega-strategies/fcn/FCNStructs.sol";
import { IOracleEntry } from "./oracle-entry/interfaces/IOracleEntry.sol";

uint32 constant DCS_STRATEGY_ID = 1;
uint32 constant FCN_STRATEGY_ID = 2;

struct DepositQueue {
    uint128 queuedDepositsTotalAmount;
    uint128 processedIndex;
    mapping(address => uint128) amounts;
    address[] depositors;
    mapping(address => bool) depositorExists;
}

struct Withdrawer {
    address account;
    uint32 nextProductId;
}

struct ProductMetadata {
    string name;
    string tradeWinnerNftImage;
}

struct WithdrawalQueue {
    uint128 queuedWithdrawalSharesAmount;
    uint128 processedIndex;
    mapping(address => mapping(uint32 => uint256)) amounts;
    Withdrawer[] withdrawers;
    mapping(address => bool) withdrawingWithProxy;
}

struct CegaGlobalStorage {
    // Global information
    uint32 strategyIdCounter;
    uint32 productIdCounter;
    uint32[] strategyIds;
    mapping(uint32 => uint32) strategyOfProduct;
    mapping(uint32 => ProductMetadata) productMetadata;
    mapping(address => Vault) vaults;
    // DCS information
    mapping(uint32 => DCSProduct) dcsProducts;
    // Shared
    mapping(uint32 => DepositQueue) depositQueues;
    // DCS information
    mapping(address => DCSVault) dcsVaults;
    // Shared
    mapping(address => WithdrawalQueue) withdrawalQueues;
    // vaultAddress => (asset/s hash => timestamp => price)
    mapping(address => mapping(bytes32 => mapping(uint40 => uint128))) oraclePriceOverride;
    // this will be a bitmap that has all the configs for pausing
    uint256 protocolPauseConfig;
    // FCN information
    mapping(uint32 => FCNProduct) fcnProducts;
    mapping(address => FCNVault) fcnVaults;
    mapping(address => bool) fcnBondAllowList;
}

struct Vault {
    uint128 totalAssets;
    uint64 auctionWinnerTokenId;
    uint16 yieldFeeBps;
    uint16 managementFeeBps;
    uint32 productId;
    address auctionWinner;
    uint40 tradeStartDate;
    VaultStatus vaultStatus;
    IOracleEntry.DataSource dataSource;
    bool isInDispute;
    bool isDefaulted;
}

enum OldVaultStatus {
    DepositsClosed,
    DepositsOpen,
    NotTraded,
    Traded,
    TradeExpired,
    FeesCollected,
    WithdrawalQueueProcessed,
    Zombie
}

enum VaultStatus {
    DepositsClosed,
    DepositsOpen,
    PreAuction,
    Auctioned,
    Traded,
    AwaitingSettlement,
    Settled,
    FeesCollected,
    WithdrawalQueueProcessed,
    Zombie
}

struct MMNFTMetadata {
    address vaultAddress;
    uint40 tradeStartDate;
    uint40 tradeEndDate;
    uint16 aprBps;
    uint128 notional;
    uint128 initialSpotPrice;
    uint128 strikePrice;
}

struct VaultCreationParams {
    string tokenName;
    string tokenSymbol;
    uint16 yieldFeeBps;
    uint16 managementFeeBps;
}

File 5 of 31 : ICommonEvents.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.24;

import { VaultStatus, OldVaultStatus } from "../../../Structs.sol";

interface ICommonEvents {
    event DepositQueued(
        uint32 indexed productId,
        address sender,
        address receiver,
        uint128 amount
    );

    event DepositRemoved(
        uint32 indexed productId,
        address depositor,
        uint128 amount
    );

    event DepositProcessed(
        address indexed vaultAddress,
        address receiver,
        uint128 amount
    );

    event WithdrawalQueued(
        address indexed vaultAddress,
        uint256 sharesAmount,
        address owner,
        uint32 nextProductId,
        bool withProxy
    );

    event WithdrawalProcessed(
        address indexed vaultAddress,
        uint256 sharesAmount,
        address owner,
        uint32 nextProductId
    );

    event CommonVaultStatusUpdated(
        address indexed vaultAddress,
        VaultStatus vaultStatus
    );

    event VaultDefaultUpdated(address indexed vaultAddress, bool value);

    event OraclePriceOverriden(
        address indexed vaultAddress,
        address indexed asset,
        uint256 timestamp,
        uint256 newPrice
    );

    event ManagementFeeUpdated(address indexed vaultAddress, uint16 value);

    event YieldFeeUpdated(address indexed vaultAddress, uint16 value);

    event ProductNameUpdated(uint32 indexed productId, string name);

    event TradeWinnerNftImageUpdated(uint32 indexed productId, string imageUrl);

    // Legacy event, left for compatibility

    event VaultStatusUpdated(
        address indexed vaultAddress,
        OldVaultStatus vaultStatus
    );
}

File 6 of 31 : DCSStructs.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.24;

enum DCSOptionType {
    BuyLow,
    SellHigh
}

enum SettlementStatus {
    NotAuctioned,
    Auctioned,
    InitialPremiumPaid,
    AwaitingSettlement,
    Settled,
    Defaulted
}

struct DCSProductCreationParams {
    uint128 maxUnderlyingAmountLimit;
    uint128 minDepositAmount;
    uint128 minWithdrawalAmount;
    address quoteAssetAddress;
    address baseAssetAddress;
    DCSOptionType dcsOptionType;
    uint8 daysToStartLateFees;
    uint8 daysToStartAuctionDefault;
    uint8 daysToStartSettlementDefault;
    uint16 lateFeeBps;
    uint16 strikeBarrierBps;
    uint40 tenorInSeconds;
    uint8 disputePeriodInHours;
    uint8 disputeGraceDelayInHours;
    string name;
    string tradeWinnerNftImage;
}

struct DCSProduct {
    uint128 maxUnderlyingAmountLimit;
    uint128 minDepositAmount;
    uint128 minWithdrawalAmount;
    uint128 sumVaultUnderlyingAmounts; //revisit later
    address quoteAssetAddress; // should be immutable
    uint40 tenorInSeconds;
    uint16 lateFeeBps;
    uint8 daysToStartLateFees;
    address baseAssetAddress; // should be immutable
    uint16 strikeBarrierBps;
    uint8 daysToStartAuctionDefault;
    uint8 daysToStartSettlementDefault;
    uint8 disputePeriodInHours;
    DCSOptionType dcsOptionType;
    bool isDepositQueueOpen;
    address[] vaults;
    uint8 disputeGraceDelayInHours;
}

struct DCSVault {
    uint128 initialSpotPrice;
    uint128 strikePrice;
    uint128 totalYield;
    uint16 aprBps;
    SettlementStatus settlementStatus; // DEPRECATED
    bool isPayoffInDepositAsset;
}

File 7 of 31 : IDCSBulkActionsEntry.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.24;

import { Withdrawer, VaultStatus } from "../../../Structs.sol";
import { DCSProductCreationParams, DCSProduct } from "../DCSStructs.sol";
import {
    IOracleEntry
} from "../../../oracle-entry/interfaces/IOracleEntry.sol";

interface IDCSBulkActionsEntry {
    /**
     * @dev Starts trading for multiple vaults in bulk.
     * @param vaultAddresses Array of vault addresses to start trading for.
     */
    function dcsBulkStartTrades(
        address[] calldata vaultAddresses
    ) external payable;

    /**
     * @dev Processes the deposit queues for multiple vaults in bulk.
     * @param vaultAddresses Array of vault addresses to process deposit queues for.
     * @param maxProcessCount The maximum number of deposits to process for each vault.
     */
    function dcsBulkProcessDepositQueues(
        address[] calldata vaultAddresses,
        uint256 maxProcessCount
    ) external;

    /**
     * @dev Processes the withdrawal queues for multiple vaults in bulk.
     * @param vaultAddresses Array of vault addresses to process withdrawal queues for.
     * @param maxProcessCount The maximum number of withdrawals to process for each vault.
     */
    function dcsBulkProcessWithdrawalQueues(
        address[] calldata vaultAddresses,
        uint256 maxProcessCount
    ) external;

    /**
     * @dev Rolls over multiple vaults to the next cycle in bulk.
     * @param vaultAddresses Array of vault addresses to roll over.
     */
    function dcsBulkRolloverVaults(address[] calldata vaultAddresses) external;

    /**
     * @dev Checks and handles trade expiry for multiple vaults in bulk.
     * @param vaultAddresses Array of vault addresses to check for trade expiry.
     */
    function dcsBulkCheckTradesExpiry(
        address[] calldata vaultAddresses
    ) external;

    /**
     * @dev Checks and handles auction default for multiple vaults in bulk.
     * @param vaultAddresses Array of vault addresses to check for auction default.
     */
    function dcsBulkCheckAuctionDefault(
        address[] calldata vaultAddresses
    ) external;

    /**
     * @dev Checks and handles settlement default for multiple vaults in bulk.
     * @param vaultAddresses Array of vault addresses to check for settlement default.
     */
    function dcsBulkCheckSettlementDefault(
        address[] calldata vaultAddresses
    ) external;

    /**
     * @dev Settles multiple vaults in bulk.
     * @param vaultAddresses Array of vault addresses to settle.
     */
    function dcsBulkSettleVaults(
        address[] calldata vaultAddresses
    ) external payable;

    /**
     * @dev Collects fees from multiple vaults in bulk.
     * @param vaultAddresses Array of vault addresses to collect fees from.
     */
    function dcsBulkCollectFees(address[] calldata vaultAddresses) external;
}

File 8 of 31 : IDCSConfigurationEntry.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.24;

interface IDCSConfigurationEntry {
    /**
     * @dev Sets the late fee basis points for a specific product.
     * @param lateFeeBps The late fee in basis points.
     * @param productId The ID of the product.
     */
    function dcsSetLateFeeBps(uint16 lateFeeBps, uint32 productId) external;

    /**
     * @dev Sets the minimum deposit amount for a specific product.
     * @param minDepositAmount The minimum deposit amount.
     * @param productId The ID of the product.
     */
    function dcsSetMinDepositAmount(
        uint128 minDepositAmount,
        uint32 productId
    ) external;

    /**
     * @dev Sets the minimum withdrawal amount for a specific product.
     * @param minWithdrawalAmount The minimum withdrawal amount.
     * @param productId The ID of the product.
     */
    function dcsSetMinWithdrawalAmount(
        uint128 minWithdrawalAmount,
        uint32 productId
    ) external;

    /**
     * @dev Sets whether the deposit queue is open for a specific product.
     * @param isDepositQueueOpen True if the deposit queue is open.
     * @param productId The ID of the product.
     */
    function dcsSetIsDepositQueueOpen(
        bool isDepositQueueOpen,
        uint32 productId
    ) external;

    /**
     * @dev Sets the number of days to start charging late fees for a specific product.
     * @param productId The ID of the product.
     * @param daysToStartLateFees The number of days to start late fees.
     */
    function dcsSetDaysToStartLateFees(
        uint32 productId,
        uint8 daysToStartLateFees
    ) external;

    /**
     * @dev Sets the number of days to start auction default for a specific product.
     * @param productId The ID of the product.
     * @param daysToStartAuctionDefault The number of days to start auction default.
     */
    function dcsSetDaysToStartAuctionDefault(
        uint32 productId,
        uint8 daysToStartAuctionDefault
    ) external;

    /**
     * @dev Sets the number of days to start settlement default for a specific product.
     * @param productId The ID of the product.
     * @param daysToStartSettlementDefault The number of days to start settlement default.
     */
    function dcsSetDaysToStartSettlementDefault(
        uint32 productId,
        uint8 daysToStartSettlementDefault
    ) external;

    /**
     * @dev Sets the maximum underlying amount for a specific product.
     * @param maxUnderlyingAmountLimit The maximum underlying amount limit.
     * @param productId The ID of the product.
     */
    function dcsSetMaxUnderlyingAmount(
        uint128 maxUnderlyingAmountLimit,
        uint32 productId
    ) external;

    /**
     * @dev Sets the dispute period in hours for a specific product.
     * @param productId The ID of the product.
     * @param disputePeriodInHours The dispute period in hours.
     */
    function dcsSetDisputePeriodInHours(
        uint32 productId,
        uint8 disputePeriodInHours
    ) external;

    /**
     * @notice Sets dispute grace period for the product
     * @param productId ID of the product
     * @param disputeGraceDelayInHours Dispute period in hours
     */
    function dcsSetDisputeGraceDelayInHours(
        uint32 productId,
        uint8 disputeGraceDelayInHours
    ) external;
}

File 9 of 31 : IDCSEntry.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.24;

import { IDCSEvents } from "./IDCSEvents.sol";
import { IDCSProductEntry } from "./IDCSProductEntry.sol";
import { IDCSVaultEntry } from "./IDCSVaultEntry.sol";
import { IDCSConfigurationEntry } from "./IDCSConfigurationEntry.sol";
import { IDCSBulkActionsEntry } from "./IDCSBulkActionsEntry.sol";
import { IDCSViewEntry } from "./IDCSViewEntry.sol";
import {
    IProductViewEntry
} from "../../../common/interfaces/IProductViewEntry.sol";
import {
    IVaultViewEntry
} from "../../../common/interfaces/IVaultViewEntry.sol";
import {
    IVaultConfigurationEntry
} from "../../../common/interfaces/IVaultConfigurationEntry.sol";
import {
    IConfigurationEntry
} from "../../../common/interfaces/IConfigurationEntry.sol";
import { IProductEntry } from "../../../common/interfaces/IProductEntry.sol";

interface IDCSEntry is
    IDCSEvents,
    IDCSProductEntry,
    IDCSVaultEntry,
    IDCSConfigurationEntry,
    IDCSBulkActionsEntry,
    IDCSViewEntry,
    IProductViewEntry,
    IVaultViewEntry,
    IVaultConfigurationEntry,
    IConfigurationEntry,
    IProductEntry
{}

File 10 of 31 : IDCSEvents.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.24;

import { ICommonEvents } from "../../common/interfaces/ICommonEvents.sol";
import { VaultCreationParams } from "../../../Structs.sol";
import { SettlementStatus } from "../DCSStructs.sol";

interface IDCSEvents is ICommonEvents {
    event DCSProductCreated(uint32 indexed productId);

    event DCSVaultFeesCollected(
        address indexed vaultAddress,
        uint128 totalFees,
        uint128 managementFee,
        uint128 yieldFee
    );

    event DCSVaultCreated(
        uint32 indexed productId,
        address indexed vaultAddress,
        VaultCreationParams params
    );

    event DCSAuctionEnded(
        address indexed vaultAddress,
        address indexed auctionWinner,
        uint40 tradeStartDate,
        uint16 aprBps,
        uint128 initialSpotPrice,
        uint128 strikePrice
    );

    event DCSTradeStarted(
        address indexed vaultAddress,
        address auctionWinner,
        uint128 notionalAmount,
        uint128 yieldAmount
    );

    event DCSLateFeePaid(address indexed vaultAddress, uint128 feeAmount);

    event DCSVaultSettled(
        address indexed vaultAddress,
        address settler,
        uint128 depositedAmount,
        uint128 withdrawnAmount
    );

    event DCSVaultRolledOver(address indexed vaultAddress);

    event DCSIsPayoffInDepositAssetUpdated(
        address indexed vaultAddress,
        bool isPayoffInDepositAsset
    );

    event DCSLateFeeBpsUpdated(uint32 indexed productId, uint16 lateFeeBps);

    event DCSMinDepositAmountUpdated(
        uint32 indexed productId,
        uint128 minDepositAmount
    );

    event DCSMinWithdrawalAmountUpdated(
        uint32 indexed productId,
        uint128 minWithdrawalAmount
    );

    event DCSIsDepositQueueOpenUpdated(
        uint32 indexed productId,
        bool isDepositQueueOpen
    );

    event DCSMaxUnderlyingAmountLimitUpdated(
        uint32 indexed productId,
        uint128 maxUnderlyingAmountLimit
    );

    event DCSManagementFeeUpdated(address indexed vaultAddress, uint16 value);

    event DCSYieldFeeUpdated(address indexed vaultAddress, uint16 value);

    event DCSDisputeSubmitted(address indexed vaultAddress);

    event DCSDisputeProcessed(
        address indexed vaultAddress,
        bool isDisputeAccepted,
        uint40 timestamp,
        uint128 newPrice
    );

    event DCSDisputePeriodInHoursUpdated(
        uint32 indexed productId,
        uint8 disputePeriodInHours
    );

    event DCSDisputeGraceDelayInHoursUpdated(
        uint32 indexed productId,
        uint8 disputeGraceDelayInHours
    );

    event DCSDaysToStartLateFeesUpdated(
        uint32 indexed productId,
        uint8 daysToStartLateFees
    );

    event DCSDaysToStartAuctionDefaultUpdated(
        uint32 indexed productId,
        uint8 daysToStartAuctionDefault
    );

    event DCSDaysToStartSettlementDefaultUpdated(
        uint32 indexed productId,
        uint8 daysToStartSettlementDefault
    );

    // Legacy events, left for compatibility

    event VaultCreated(
        uint32 indexed productId,
        address indexed vaultAddress,
        string _tokenSymbol,
        string _tokenName
    );

    event DCSSettlementStatusUpdated(
        address indexed vaultAddress,
        SettlementStatus settlementStatus
    );
}

File 11 of 31 : IDCSProductEntry.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.24;

import { Withdrawer, VaultStatus } from "../../../Structs.sol";
import { DCSProductCreationParams, DCSProduct } from "../DCSStructs.sol";
import {
    IOracleEntry
} from "../../../oracle-entry/interfaces/IOracleEntry.sol";

interface IDCSProductEntry {
    // FUNCTIONS

    /**
     * @dev Creates a new DCS product with the given parameters.
     * @param creationParams The parameters required for creating a new DCS product.
     * @return uint32 The ID of the newly created product.
     */
    function dcsCreateProduct(
        DCSProductCreationParams calldata creationParams
    ) external returns (uint32);

    /**
     * @dev Adds an amount to the deposit queue for a specified product.
     * @param productId The ID of the product for which the deposit is being made.
     * @param amount The amount to be deposited.
     * @param receiver The address that will receive the deposit.
     */
    function dcsAddToDepositQueue(
        uint32 productId,
        uint128 amount,
        address receiver
    ) external payable;

    function dcsRemoveFromDepositQueue(
        uint32 productId,
        uint128 amount
    ) external;

    /**
     * @dev Processes the deposit queue for a specific vault, up to a maximum count of deposits.
     * @param vault The address of the vault for which to process deposits.
     * @param maxProcessCount The maximum number of deposits to process.
     */
    function dcsProcessDepositQueue(
        address vault,
        uint256 maxProcessCount
    ) external;

    /**
     * @dev Adds a request to the withdrawal queue for a specific vault.
     * @param vault The address of the vault.
     * @param sharesAmount The amount of shares to withdraw.
     * @param nextProductId The product ID for the next investment cycle, if applicable.
     */
    function dcsAddToWithdrawalQueue(
        address vault,
        uint128 sharesAmount,
        uint32 nextProductId
    ) external;

    /**
     * @dev Adds a request to the withdrawal queue with proxy for a specific vault.
     * @param vaultAddress The address of the vault.
     * @param sharesAmount The amount of shares to withdraw.
     */
    function dcsAddToWithdrawalQueueWithProxy(
        address vaultAddress,
        uint128 sharesAmount
    ) external;

    /**
     * @dev Processes the withdrawal queue for a specific vault, up to a maximum count of withdrawals.
     * @param vault The address of the vault for which to process withdrawals.
     * @param maxProcessCount The maximum number of withdrawals to process.
     */
    function dcsProcessWithdrawalQueue(
        address vault,
        uint256 maxProcessCount
    ) external;

    /**
     * @dev Checks and handles trade expiry for a specific vault.
     * @param vaultAddress The address of the vault to check for trade expiry.
     */
    function dcsCheckTradeExpiry(address vaultAddress) external;

    /**
     * @dev Checks and handles settlement default for a specific vault.
     * @param vaultAddress The address of the vault to check for settlement default.
     */
    function dcsCheckSettlementDefault(address vaultAddress) external;

    /**
     * @dev Collects fees from a specific vault.
     * @param vaultAddress The address of the vault from which to collect fees.
     */
    function dcsCollectVaultFees(address vaultAddress) external;

    /**
     * @dev Submits a dispute for a specific vault.
     * @param vaultAddress The address of the vault for which to submit a dispute.
     */
    function dcsSubmitDispute(address vaultAddress) external;

    /**
     * @dev Processes a trade dispute for a specific vault, potentially adjusting the price.
     * @param vaultAddress The address of the vault for which to process the dispute.
     * @param newPrice The new price to be considered in resolving the dispute.
     */
    function dcsProcessTradeDispute(
        address vaultAddress,
        uint128 newPrice
    ) external;
}

File 12 of 31 : IDCSVaultEntry.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.24;

import { VaultStatus, Vault, VaultCreationParams } from "../../../Structs.sol";
import { DCSVault } from "../DCSStructs.sol";
import {
    IOracleEntry
} from "../../../oracle-entry/interfaces/IOracleEntry.sol";
import { ISwapManager } from "../../../swaps/interfaces/ISwapManager.sol";

interface IDCSVaultEntry {
    // FUNCTIONS

    /**
     * @notice Creates a new vault with specified parameters.
     * @param _productId The product ID associated with the vault.
     * @param creationParams The params of the vault.
     * @return vaultAddress The address of the newly created vault.
     */
    function dcsCreateVault(
        uint32 _productId,
        VaultCreationParams calldata creationParams
    ) external returns (address vaultAddress);

    /**
     * @notice Ends the auction for a vault and sets it up for trading.
     * @param vaultAddress The address of the vault.
     * @param _auctionWinner The address of the auction winner.
     * @param _tradeStartDate The start date of the trade.
     * @param _aprBps The annual percentage rate in basis points.
     * @param dataSource The data source for the oracle.
     */
    function dcsEndAuction(
        address vaultAddress,
        address _auctionWinner,
        uint40 _tradeStartDate,
        uint16 _aprBps,
        IOracleEntry.DataSource dataSource
    ) external;

    /**
     * @notice Starts trading for a vault.
     * @param vaultAddress The address of the vault to start trading.
     */
    function dcsStartTrade(address vaultAddress) external payable;

    /**
     * @notice Settles a vault.
     * @param vaultAddress The address of the vault to settle.
     */
    function dcsSettleVault(address vaultAddress) external payable;

    /**
     * @notice Swaps vaults funds on DEX and settles trade
     * @param vaultAddress Address of the vault to settle
     * @param swapProtocol Protocol to use for swap
     * @param swapData Swap params
     */
    function dcsSwapAndSettleVault(
        address vaultAddress,
        ISwapManager.SwapProtocol swapProtocol,
        ISwapManager.SwapData calldata swapData
    ) external payable;

    /**
     * @notice Rolls over a vault to a new period.
     * @param vaultAddress The address of the vault to roll over.
     */
    function dcsRolloverVault(address vaultAddress) external;

    /**
     * @notice Sets whether the payoff for a vault is in the deposit asset.
     * @param vaultAddress The address of the vault.
     * @param newState True if the payoff is in the deposit asset, false otherwise.
     */
    function dcsSetIsPayoffInDepositAsset(
        address vaultAddress,
        bool newState
    ) external;

    /**
     * @notice Checks if an auction default has occurred for a specific vault.
     * @param vaultAddress The address of the vault to check.
     */
    function dcsCheckAuctionDefault(address vaultAddress) external;
}

File 13 of 31 : IDCSViewEntry.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.24;

import { Withdrawer } from "../../../Structs.sol";
import { DCSProduct, DCSVault } from "../DCSStructs.sol";

interface IDCSViewEntry {
    /**
     * @dev Retrieves detailed information about a specific DCS product.
     * @param productId The product ID.
     * @return DCSProduct Struct containing detailed information about the product.
     */
    function dcsGetProduct(
        uint32 productId
    ) external view returns (DCSProduct memory);

    /**
     * @dev Retrieves the deposit asset address for a specific product.
     * @param productId The product ID.
     * @return address Address of the deposit asset.
     */
    function dcsGetProductDepositAsset(
        uint32 productId
    ) external view returns (address);

    /**
     * @dev Calculates the final payoff for a specific vault.
     * @param vaultAddress The vault address.
     * @return uint128 The calculated final payoff amount.
     */
    function dcsCalculateVaultFinalPayoff(
        address vaultAddress
    ) external view returns (uint128);

    /**
     * @notice Retrieves the details of a specific vault.
     * @param vaultAddress The address of the vault to retrieve.
     * @return A struct containing details of the vault.
     */
    function dcsGetVault(
        address vaultAddress
    ) external view returns (DCSVault memory);

    /**
     * @notice Calculates the late fee for a specific vault.
     * @param vaultAddress The address of the vault.
     * @return The calculated late fee.
     */
    function dcsCalculateLateFee(
        address vaultAddress
    ) external view returns (uint128);

    /**
     * @notice Retrieves the coupon payment for a specific vault.
     * @param vaultAddress The address of the vault.
     * @return The amount of the coupon payment.
     */
    function dcsGetCouponPayment(
        address vaultAddress
    ) external view returns (uint128);

    /**
     * @notice Retrieves the settlement asset for a specific vault.
     * @param vaultAddress The address of the vault.
     * @return The address of the settlement asset.
     */
    function dcsGetVaultSettlementAsset(
        address vaultAddress
    ) external view returns (address);
}

File 14 of 31 : FCNStructs.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.24;

import { IOracleEntry } from "../../oracle-entry/interfaces/IOracleEntry.sol";

struct FCNProductCreationParams {
    uint128 minDepositAmount;
    uint128 minWithdrawalAmount;
    uint128 maxUnderlyingAmountLimit;
    address underlyingAsset;
    uint64 leverage;
    uint40 tenorInSeconds;
    uint8 daysToStartLateFees;
    uint8 daysToStartAuctionDefault;
    uint8 daysToStartSettlementDefault;
    uint8 disputePeriodInHours;
    uint8 disputeGraceDelayInHours;
    uint16 lateFeeBps;
    string name;
    string tradeWinnerNftImage;
    bool isBondOption;
    uint24 observationIntervalInSeconds;
    FCNOptionBarrier[] optionBarriers;
}

struct FCNProduct {
    uint128 minDepositAmount;
    uint128 minWithdrawalAmount;
    uint128 maxUnderlyingAmountLimit;
    uint128 sumVaultUnderlyingAmounts;
    address underlyingAsset;
    uint64 leverage;
    uint40 tenorInSeconds;
    uint8 daysToStartLateFees;
    uint8 daysToStartAuctionDefault;
    uint8 daysToStartSettlementDefault;
    uint8 disputePeriodInHours;
    uint8 disputeGraceDelayInHours;
    uint16 lateFeeBps;
    bool isDepositQueueOpen;
    bool isBondOption;
    uint24 observationIntervalInSeconds;
    FCNOptionBarrier[] optionBarriers;
    address[] vaults;
}

struct FCNVaultCreationParams {
    string tokenName;
    string tokenSymbol;
    uint16 yieldFeeBps;
    uint16 managementFeeBps;
}

struct FCNVaultBarrierData {
    uint128 initialSpotPrice;
    IOracleEntry.DataSource dataSource;
}

struct FCNVault {
    uint128 notional;
    uint128 totalYield;
    uint16 aprBps;
    bool isKnockedIn;
    uint16 observationsDone;
    uint96 buffer; // buffer if we need to add any more data
    FCNVaultBarrierData[] barrierData;
}

struct FCNOptionBarrier {
    uint16 barrierBps;
    FCNOptionBarrierType barrierType;
    address asset;
    uint8 exponent;
}

enum FCNOptionBarrierType {
    None,
    KnockIn
}

enum FCNVaultStatus {
    DepositsClosed,
    DepositsOpen,
    PreAuction,
    Auctioned,
    Traded,
    AwaitingSettlement,
    Settled,
    FeesCollected,
    WithdrawalQueueProcessed,
    Zombie
}

File 15 of 31 : IFCNBulkActionsEntry.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.17;

interface IFCNBulkActionsEntry {
    function fcnBulkProcessDepositQueues(
        address[] calldata vaultAddresses,
        uint256 maxProcessCount
    ) external;

    function fcnBulkProcessWithdrawalQueues(
        address[] calldata vaultAddresses,
        uint256 maxProcessCount
    ) external;

    function fcnBulkStartTrades(
        address[] calldata vaultAddresses
    ) external payable;

    function fcnBulkCheckBarriers(
        address[] calldata vaultAddresses,
        uint16 maxObservations
    ) external;

    function fcnBulkCheckTradesExpiry(
        address[] calldata vaultAddresses
    ) external;

    function fcnBulkRepayBonds(
        address[] calldata vaultAddresses,
        uint128[] calldata amounts
    ) external payable;

    function fcnBulkSettleVaults(
        address[] calldata vaultAddresses
    ) external payable;

    function fcnBulkCollectFees(address[] calldata vaultAddresses) external;

    function fcnBulkRolloverVaults(address[] calldata vaultAddresses) external;

    function fcnBulkCheckSettlementDefault(
        address[] calldata vaultAddresses
    ) external;

    function fcnBulkCheckAuctionDefault(
        address[] calldata vaultAddresses
    ) external;
}

File 16 of 31 : IFCNConfigurationEntry.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.24;

interface IFCNConfigurationEntry {
    function fcnSetLateFeeBps(uint32 productId, uint16 lateFeeBps) external;

    function fcnSetMinDepositAmount(
        uint32 productId,
        uint128 minDepositAmount
    ) external;

    function fcnSetMinWithdrawalAmount(
        uint32 productId,
        uint128 minWithdrawalAmount
    ) external;

    function fcnSetIsDepositQueueOpen(
        uint32 productId,
        bool isDepositQueueOpen
    ) external;

    function fcnSetDaysToStartLateFees(
        uint32 productId,
        uint8 daysToStartLateFees
    ) external;

    function fcnSetDaysToStartAuctionDefault(
        uint32 productId,
        uint8 daysToStartAuctionDefault
    ) external;

    function fcnSetDaysToStartSettlementDefault(
        uint32 productId,
        uint8 daysToStartSettlementDefault
    ) external;

    function fcnSetMaxUnderlyingAmountLimit(
        uint32 productId,
        uint128 maxUnderlyingAmountLimit
    ) external;

    function fcnSetDisputePeriodInHours(
        uint32 productId,
        uint8 disputePeriodInHours
    ) external;

    function fcnSetBondAllowList(address receiver, bool value) external;

    function fcnSetDisputeGraceDelayInHours(
        uint32 productId,
        uint8 disputeGraceDelayInHours
    ) external;
}

File 17 of 31 : IFCNEntry.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.24;

import { IFCNEvents } from "./IFCNEvents.sol";
import { IFCNConfigurationEntry } from "./IFCNConfigurationEntry.sol";
import { IFCNProductEntry } from "./IFCNProductEntry.sol";
import { IFCNVaultEntry } from "./IFCNVaultEntry.sol";
import { IFCNBulkActionsEntry } from "./IFCNBulkActionsEntry.sol";
import { IFCNViewEntry } from "./IFCNViewEntry.sol";
import {
    IProductViewEntry
} from "../../../common/interfaces/IProductViewEntry.sol";
import {
    IVaultViewEntry
} from "../../../common/interfaces/IVaultViewEntry.sol";
import {
    IVaultConfigurationEntry
} from "../../../common/interfaces/IVaultConfigurationEntry.sol";
import {
    IConfigurationEntry
} from "../../../common/interfaces/IConfigurationEntry.sol";
import { IProductEntry } from "../../../common/interfaces/IProductEntry.sol";

interface IFCNEntry is
    IFCNEvents,
    IFCNConfigurationEntry,
    IFCNProductEntry,
    IFCNVaultEntry,
    IFCNViewEntry,
    IFCNBulkActionsEntry,
    IProductViewEntry,
    IVaultViewEntry,
    IVaultConfigurationEntry,
    IConfigurationEntry,
    IProductEntry
{}

File 18 of 31 : IFCNEvents.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.24;

import { ICommonEvents } from "../../common/interfaces/ICommonEvents.sol";
import { FCNVaultCreationParams } from "../FCNStructs.sol";

interface IFCNEvents is ICommonEvents {
    event FCNProductCreated(uint32 indexed productId);

    event FCNVaultCreated(
        uint32 indexed productId,
        address indexed vaultAddress,
        FCNVaultCreationParams creationParams
    );

    event FCNLateFeeBpsUpdated(uint32 indexed productId, uint16 lateFeeBps);

    event FCNMinDepositAmountUpdated(
        uint32 indexed productId,
        uint128 minDepositAmount
    );

    event FCNMinWithdrawalAmountUpdated(
        uint32 indexed productId,
        uint128 minWithdrawalAmount
    );

    event FCNIsDepositQueueOpenUpdated(
        uint32 indexed productId,
        bool isDepositQueueOpen
    );

    event FCNMaxUnderlyingAmountLimitUpdated(
        uint32 indexed productId,
        uint128 maxUnderlyingAmountLimit
    );

    event FCNDisputePeriodInHoursUpdated(
        uint32 indexed productId,
        uint8 disputePeriodInHours
    );

    event FCNDisputeGraceDelayInHoursUpdated(
        uint32 indexed productId,
        uint8 disputeGraceDelayInHours
    );

    event FCNDaysToStartLateFeesUpdated(
        uint32 indexed productId,
        uint8 daysToStartLateFees
    );

    event FCNDaysToStartAuctionDefaultUpdated(
        uint32 indexed productId,
        uint8 daysToStartAuctionDefault
    );

    event FCNDaysToStartSettlementDefaultUpdated(
        uint32 indexed productId,
        uint8 daysToStartSettlementDefault
    );

    event FCNAuctionEnded(
        address indexed vaultAddress,
        address indexed auctionWinner,
        uint40 tradeStartDate,
        uint16 aprBps,
        uint128[] initialSpotPrices
    );

    event FCNTradeStarted(
        address indexed vaultAddress,
        address auctionWinner,
        uint128 notionalAmount,
        uint128 yieldAmount
    );

    event FCNIsKnockedInUpdated(address indexed vaultAddress, bool isKnockedIn);

    event FCNLateFeePaid(address indexed vaultAddress, uint128 feeAmount);

    event FCNBondRepaid(address indexed vaultAddress, uint128 amount);

    event FCNVaultRolledOver(address indexed vaultAddress);

    event FCNBondAllowListUpdated(address indexed receiver, bool value);

    event FCNVaultFeesCollected(
        address indexed vaultAddress,
        uint128 totalFees,
        uint128 managementFee,
        uint128 yieldFee
    );

    event FCNDisputeProcessed(
        address indexed vaultAddress,
        bool isDisputeAccepted,
        uint8 barrierIndex,
        uint40 timestamp,
        uint128 newPrice
    );

    event FCNDisputeSubmitted(
        address indexed vaultAddress,
        uint8 barrierIndex,
        uint40 timestamp
    );
}

File 19 of 31 : IFCNProductEntry.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.24;

import {
    FCNProductCreationParams,
    FCNVaultCreationParams
} from "../FCNStructs.sol";

interface IFCNProductEntry {
    function fcnCreateProduct(
        FCNProductCreationParams calldata creationParams
    ) external returns (uint32);

    function fcnCreateVault(
        uint32 productId,
        FCNVaultCreationParams calldata creationParams
    ) external returns (address vaultAddress);

    function fcnAddToDepositQueue(
        uint32 productId,
        uint128 amount,
        address receiver
    ) external payable;

    function fcnRemoveFromDepositQueue(
        uint32 productId,
        uint128 amount
    ) external;

    function fcnProcessDepositQueue(
        address vaultAddress,
        uint256 maxProcessCount
    ) external;

    function fcnAddToWithdrawalQueue(
        address vaultAddress,
        uint128 sharesAmount,
        uint32 nextProductId
    ) external;

    function fcnAddToWithdrawalQueueWithProxy(
        address vaultAddress,
        uint128 sharesAmount
    ) external;

    function fcnProcessWithdrawalQueue(
        address vaultAddress,
        uint256 maxProcessCount
    ) external;
}

File 20 of 31 : IFCNVaultEntry.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.24;

import {
    IOracleEntry
} from "../../../oracle-entry/interfaces/IOracleEntry.sol";

interface IFCNVaultEntry {
    function fcnEndAuction(
        address vaultAddress,
        address auctionWinner,
        uint40 tradeStartDate,
        uint16 aprBps,
        IOracleEntry.DataSource[] calldata dataSources
    ) external;

    function fcnStartTrade(address vaultAddress) external payable;

    function fcnCheckBarriers(
        address vaultAddress,
        uint16 maxObservations
    ) external;

    function fcnCheckTradeExpiry(address vaultAddress) external;

    function fcnRepayBond(
        address vaultAddress,
        uint128 amount
    ) external payable;

    function fcnSettleVault(address vaultAddress) external payable;

    function fcnCollectVaultFees(address vaultAddress) external;

    function fcnRolloverVault(address vaultAddress) external;

    function fcnCheckSettlementDefault(address vaultAddress) external;

    function fcnCheckAuctionDefault(address vaultAddress) external;

    function fcnSubmitDispute(
        address vaultAddress,
        uint8 barrierIndex,
        uint40 timestamp
    ) external;

    function fcnProcessTradeDispute(
        address vaultAddress,
        uint8 barrierIndex,
        uint40 timestamp,
        uint128 newPrice
    ) external;
}

File 21 of 31 : IFCNViewEntry.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.24;

import { FCNProduct, FCNVault } from "../FCNStructs.sol";

interface IFCNViewEntry {
    function fcnGetProduct(
        uint32 productId
    ) external view returns (FCNProduct memory);

    function fcnGetProductDepositAsset(
        uint32 productId
    ) external view returns (address);

    function fcnGetVault(
        address vaultAddress
    ) external view returns (FCNVault memory);

    function fcnGetCouponPayment(
        address vaultAddress
    ) external view returns (uint128);

    function fcnCalculateVaultFinalPayoff(
        address vaultAddress
    ) external view returns (uint128);

    function fcnCalculateRepaidBond(
        address vaultAddress
    ) external view returns (uint128);

    function fcnCalculateVaultSettlementAmount(
        address vaultAddress
    ) external view returns (uint128);

    function fcnGetBondAllowList(address receiver) external view returns (bool);

    function fcnCalculateLateFee(
        address vaultAddress
    ) external view returns (uint128);
}

File 22 of 31 : IConfigurationEntry.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.24;

interface IConfigurationEntry {
    // FUNCTIONS

    function setManagementFee(address vaultAddress, uint16 value) external;

    function setYieldFee(address vaultAddress, uint16 value) external;

    function setProductName(uint32 productId, string calldata name) external;

    function setTradeWinnerNftImage(
        uint32 productId,
        string calldata imageUrl
    ) external;

    function setIsDefaulted(address vaultAddress, bool newState) external;
}

File 23 of 31 : IProductEntry.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.24;

interface IProductEntry {
    function addToDepositQueue(
        uint32 productId,
        uint128 amount,
        address receiver
    ) external payable;

    function removeFromDepositQueue(uint32 productId, uint128 amount) external;

    function addToWithdrawalQueue(
        address vaultAddress,
        uint128 sharesAmount,
        uint32 nextProductId
    ) external;

    function addToWithdrawalQueueWithProxy(
        address vaultAddress,
        uint128 sharesAmount
    ) external;
}

File 24 of 31 : IProductViewEntry.sol
// SPDX-License-Identifier: BUSL-1.1

import { ProductMetadata } from "../../Structs.sol";

pragma solidity ^0.8.24;

interface IProductViewEntry {
    function getStrategyOfProduct(
        uint32 productId
    ) external view returns (uint32);

    function getLatestProductId() external view returns (uint32);

    function getProductMetadata(
        uint32 productId
    ) external view returns (ProductMetadata memory);

    function getIsProtocolPaused() external view returns (bool);

    /**
     * @dev Gets the deposit queue for a specific product, including depositors and their amounts.
     * @param productId The product ID.
     * @return depositors Array of depositor addresses.
     * @return amounts Array of deposit amounts.
     * @return totalAmount Total amount in the deposit queue.
     */
    function getDepositQueue(
        uint32 productId
    )
        external
        view
        returns (
            address[] memory depositors,
            uint128[] memory amounts,
            uint128 totalAmount
        );
}

File 25 of 31 : IVaultConfigurationEntry.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.24;

import { VaultStatus } from "../../Structs.sol";

interface IVaultConfigurationEntry {
    /**
     * @notice Opens a vault for deposits.
     * @param vaultAddress The address of the vault to open.
     */
    function openVaultDeposits(address vaultAddress) external;

    /**
     * @notice Opens batch of vaults for deposits
     * @param vaultAddresses Aaddresses of vaults to open
     */
    function bulkOpenVaultDeposits(address[] calldata vaultAddresses) external;

    /**
     * @notice Sets the status of a vault.
     * @param vaultAddress The address of the vault.
     * @param _vaultStatus The new status to set for the vault.
     */
    function setVaultStatus(
        address vaultAddress,
        VaultStatus _vaultStatus
    ) external;

    /**
     * @notice Overrides the oracle price for a specific timestamp in a vault.
     * @param vaultAddress The address of the vault.
     * @param timestamp The timestamp for which to override the price.
     * @param newPrice The new price to set.
     */
    function overrideOraclePrice(
        address vaultAddress,
        address asset,
        uint40 timestamp,
        uint128 newPrice
    ) external;

    /**
     * @notice Set if the whole protocol is paused
     * @param value The boolean value
     */
    function setIsProtocolPaused(bool value) external;
}

File 26 of 31 : IVaultViewEntry.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.24;

import { Vault, Withdrawer } from "../../Structs.sol";

interface IVaultViewEntry {
    function getOraclePriceOverride(
        address vaultAddress,
        uint40 timestamp
    ) external view returns (uint128);

    function getVault(
        address vaultAddress
    ) external view returns (Vault memory);

    function getVaultProductId(address vault) external view returns (uint32);

    function getIsAuctionDefaulted(
        address vaultAddress
    ) external view returns (bool);

    function getDaysLate(address vaultAddress) external view returns (uint256);

    function totalAssets(address vaultAddress) external view returns (uint256);

    function convertToAssets(
        address vaultAddress,
        uint256 shares
    ) external view returns (uint128);

    function convertToShares(
        address vaultAddress,
        uint128 assets
    ) external view returns (uint256);

    /**
     * @dev Gets the withdrawal queue for a specific vault, including withdrawers and their amounts.
     * @param vaultAddress The vault address.
     * @return withdrawers Array of withdrawer data.
     * @return amounts Array of withdrawal amounts.
     * @return withProxy Array indicating if withdrawals are with proxy.
     * @return totalAmount Total amount in the withdrawal queue.
     */
    function getWithdrawalQueue(
        address vaultAddress
    )
        external
        view
        returns (
            Withdrawer[] memory withdrawers,
            uint256[] memory amounts,
            bool[] memory withProxy,
            uint256 totalAmount
        );

    /**
     * @dev Checks if withdrawal is possible for a specific vault.
     * @param vaultAddress The vault address.
     * @return bool True if withdrawal is possible, false otherwise.
     */
    function isWithdrawalPossible(
        address vaultAddress
    ) external view returns (bool);
}

File 27 of 31 : IOracleEntry.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.8.24;

interface IOracleEntry {
    enum DataSource {
        None,
        Pyth
    }

    /**
     * @dev Emitted when a data source adapter is set.
     * @param dataSource The data source for which the adapter is set.
     * @param adapter The address of the adapter.
     */
    event DataSourceAdapterSet(DataSource dataSource, address adapter);

    /**
     * @notice Gets the price of an asset at a specific timestamp using a data source.
     * @param asset The address of the asset.
     * @param timestamp The timestamp for which the price is required.
     * @param dataSource The data source to use for fetching the price.
     * @return The price of the asset at the specified timestamp.
     */
    function getSinglePrice(
        address asset,
        uint40 timestamp,
        DataSource dataSource
    ) external view returns (uint128);

    /**
     * @notice Gets the price of a base asset in terms of a quote asset at a specific timestamp using a data source.
     * @param baseAsset The address of the base asset.
     * @param quoteAsset The address of the quote asset.
     * @param timestamp The timestamp for which the price is required.
     * @param dataSource The data source to use for fetching the price.
     * @return The price of the base asset in terms of the quote asset at the specified timestamp.
     */
    function getPrice(
        address baseAsset,
        address quoteAsset,
        uint40 timestamp,
        DataSource dataSource
    ) external view returns (uint128);

    /**
     * @notice Sets the adapter for a specific data source.
     * @param dataSource The data source for which to set the adapter.
     * @param adapter The address of the adapter.
     */
    function setDataSourceAdapter(
        DataSource dataSource,
        address adapter
    ) external;

    /**
     * @notice Returns the target number of decimals for price values.
     * @return The number of decimals.
     */
    function getTargetDecimals() external pure returns (uint8);
}

File 29 of 31 : IWrappingProxy.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.8.24;

interface IWrappingProxy {
    /**
     * @notice Unwraps the wrapped token and transfers the underlying token to the receiver.
     * @param receiver The address to receive the unwrapped tokens.
     * @param amount The amount of wrapped tokens to unwrap.
     */
    function unwrapAndTransfer(address receiver, uint256 amount) external;

    /**
     * @notice Wraps the token and adds it to the DCS deposit queue.
     * @param productId The product ID for the DCS deposit.
     * @param amount The amount of tokens to wrap.
     * @param receiver The address that will receive the deposit queue shares.
     */
    function wrapAndAddToDCSDepositQueue(
        uint32 productId,
        uint128 amount,
        address receiver
    ) external;

    /**
     * @notice Wraps the token and adds it to the FCN deposit queue.
     * @param productId The product ID for the FCN deposit.
     * @param amount The amount of tokens to wrap.
     * @param receiver The address that will receive the deposit queue shares.
     */
    function wrapAndAddToFCNDepositQueue(
        uint32 productId,
        uint128 amount,
        address receiver
    ) external;

    /**
     * @notice Wraps the token and adds it to the generic deposit queue.
     * @param productId The product ID for the deposit.
     * @param amount The amount of tokens to wrap.
     * @param receiver The address that will receive the deposit queue shares.
     */
    function wrapAndAddToDepositQueue(
        uint32 productId,
        uint128 amount,
        address receiver
    ) external;
}

File 30 of 31 : IWstETH.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.8.24;

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

interface IWstETH is IERC20 {
    function wrap(uint256 _stETHAmount) external returns (uint256);

    function unwrap(uint256 _wstETHAmount) external returns (uint256);
}

File 31 of 31 : ISwapManager.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.8.24;

interface ISwapManager {
    enum SwapProtocol {
        None,
        UniswapV3
    }

    struct SwapData {
        uint256 deadline;
        uint128 minOutputAmount;
        bytes extraData;
    }

    event SwapProtocolAdapterUpdated(
        SwapProtocol swapProtocol,
        address adapter
    );

    event Swapped(
        address fromAsset,
        address toAsset,
        uint128 amount,
        address receiver,
        SwapProtocol swapProtocol,
        SwapData swapData
    );

    /**
     * @notice Gets adapter address for swap protocol
     * @param swapProtocol Swap protocol
     * @return Address of the adapter
     */
    function swapProtocolAdapters(
        SwapProtocol swapProtocol
    ) external view returns (address);

    /**
     * @notice Sets (or resets) adapter for swap protocol
     * @param swapProtocol Swap protocol
     * @param adapter Address of the adapter contract
     */
    function setSwapProtocolAdapter(
        SwapProtocol swapProtocol,
        address adapter
    ) external;

    /**
     * @notice Swaps with given params
     * @param fromAsset Input asset
     * @param toAsset Output asset
     * @param amount Amount to swap
     * @param receiver Address to receive the swap
     * @param swapProtocol Protocol to use for the swap
     * @param swapData Other data for the swap
     */
    function swap(
        address fromAsset,
        address toAsset,
        uint128 amount,
        address receiver,
        SwapProtocol swapProtocol,
        SwapData calldata swapData
    ) external returns (uint128 outputAmount);
}

File 32 of 31 : Errors.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.24;

library Errors {
    string public constant NOT_CEGA_ENTRY = "1";
    string public constant NOT_CEGA_ADMIN = "2";
    string public constant NOT_TRADER_ADMIN = "3";
    string public constant NOT_TRADE_WINNER = "4";
    string public constant INVALID_VAULT = "5";
    string public constant INVALID_VAULT_STATUS = "6";
    string public constant VAULT_IN_ZOMBIE_STATE = "7";
    string public constant TRADE_DEFAULTED = "8";
    string public constant INVALID_SETTLEMENT_STATUS = "9";
    string public constant VAULT_IN_DISPUTE = "10";
    string public constant VAULT_NOT_IN_DISPUTE = "11";
    string public constant OUTSIDE_DISPUTE_PERIOD = "12";
    string public constant TRADE_HAS_NO_WINNER = "13";
    string public constant TRADE_NOT_CONVERTED = "14";
    string public constant TRADE_CONVERTED = "15";
    string public constant INVALID_TRADE_END_DATE = "16";
    string public constant INVALID_PRICE = "17";
    string public constant VALUE_TOO_SMALL = "18";
    string public constant VALUE_TOO_LARGE = "19";
    string public constant VALUE_IS_ZERO = "20";
    string public constant MAX_DEPOSIT_LIMIT_REACHED = "21";
    string public constant DEPOSIT_QUEUE_NOT_OPEN = "22";
    string public constant INVALID_QUOTE_OR_BASE_ASSETS = "23";
    string public constant INVALID_MIN_DEPOSIT_AMOUNT = "24";
    string public constant INVALID_MIN_WITHDRAWAL_AMOUNT = "25";
    string public constant INVALID_STRIKE_PRICE = "26";
    string public constant TRANSFER_FAILED = "27";
    string public constant NOT_AVAILABLE_DATA_SOURCE = "28";
    string public constant NO_PRICE_AVAILABLE = "29";
    string public constant NO_PRICE_FEED_SET = "30";
    string public constant INCOMPATIBLE_PRICE = "31";
    string public constant NOT_CEGA_ENTRY_OR_REDEPOSIT_MANAGER = "32";
    string public constant NO_PROXY_FOR_REDEPOSIT = "33";
    string public constant NOT_TRADE_WINNER_OR_TRADER_ADMIN = "34";
    string public constant TRADE_NOT_STARTED = "35";
    string public constant NOT_AVAILABLE_SWAP_TYPE = "36";
    string public constant NOT_AVAILABLE_SWAP_PATH = "37";
    string public constant PROTOCOL_PAUSED = "38";
    string public constant WRONG_STRATEGY = "39";
    string public constant INVALID_ARRAY_LENGTH = "40";
    string public constant UNKNOWN_BARRIER_TYPE = "41";
    string public constant NOT_BOND_OPTION = "42";
    string public constant UNAUTHORIZED_BOND_RECEIVER = "43";
    string public constant REMAINING_VALUE_TOO_SMALL = "44";
    string public constant VALUE_IN_DISPUTE_GRACE_DELAY = "45";
}

Settings
{
  "evmVersion": "shanghai",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "remappings": [],
  "viaIR": true,
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_cegaEntry","type":"address"},{"internalType":"contract IERC20","name":"_stETH","type":"address"},{"internalType":"contract IWstETH","name":"_wstETH","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"cegaEntry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stETH","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"unwrapAndTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"productId","type":"uint32"},{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"address","name":"receiver","type":"address"}],"name":"wrapAndAddToDCSDepositQueue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"productId","type":"uint32"},{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"address","name":"receiver","type":"address"}],"name":"wrapAndAddToDepositQueue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"productId","type":"uint32"},{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"address","name":"receiver","type":"address"}],"name":"wrapAndAddToFCNDepositQueue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wstETH","outputs":[{"internalType":"contract IWstETH","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60e06040908082523461018657606081610a728038038091610021828561018a565b8339810103126101865780516001600160a01b03919082811680820361018657602093848401518181169485820361018657870151918216938483036101865760805260a05260c052845163095ea7b360e01b80825283600483015285826044815f8019998a60248401525af1801561017c5786946044935f9261015f575b50885196879586948552600485015260248401525af1801561015557610127575b825161089890816101da82396080518181816102230152818161037f01528181610582015261073d015260a051818181607d0152818161014e015281816104f101526106ac015260c05181818160f8015281816103c20152818161054401526106ff0152f35b8161014692903d1061014e575b61013e818361018a565b8101906101c1565b505f806100c1565b503d610134565b83513d5f823e3d90fd5b61017590873d891161014e5761013e818361018a565b505f6100a0565b87513d5f823e3d90fd5b5f80fd5b601f909101601f19168101906001600160401b038211908210176101ad57604052565b634e487b7160e01b5f52604160045260245ffd5b9081602091031261018657518015158103610186579056fe604060808152600480361015610013575f80fd5b5f3560e01c9081631c05ddba146103f15781634aa07e64146103ae57816350dce3901461036b57816351a077a514610354578163846a0f23146101ec5781638ce43367146100b0575063c1fe3e481461006a575f80fd5b346100ac575f3660031901126100ac57517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b5f80fd5b9050346100ac57816003193601126100ac576001600160a01b03918135838116908190036100ac57815192636f074d1f60e11b84526024358185015260209485856024815f857f0000000000000000000000000000000000000000000000000000000000000000165af19485156101e25790869392915f966101af575b50905f6044928651978895869463a9059cbb60e01b865285015260248401527f0000000000000000000000000000000000000000000000000000000000000000165af19081156101a6575061017e57005b8161019d92903d1061019f575b6101958183610477565b810190610499565b005b503d61018b565b513d5f823e3d90fd5b848193959297503d83116101db575b6101c88183610477565b810103126100ac5751938592905f61012d565b503d6101be565b84513d5f823e3d90fd5b82346100ac576101fb36610408565b835163d7016ce360e01b815263ffffffff8085168783015291949293929160209182816024817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa9081156101e2575f9161031e575b5016600181036102725750505061019d935061066c565b60020361028557505061019d93506104b1565b85925081519180830183811067ffffffffffffffff82111761030b5781526002835261333960f01b838301525162461bcd60e51b81529283018190528151602484018190525f928492905b8285106102f2575050604492505f838284010152601f80199101168101030190fd5b84810182015186860160440152938101938593506102d0565b604185634e487b7160e01b5f525260245ffd5b90508281813d831161034d575b6103358183610477565b810103126100ac575181811681036100ac578861025b565b503d61032b565b346100ac5761019d61036536610408565b9161066c565b82346100ac575f3660031901126100ac57517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b82346100ac575f3660031901126100ac57517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b346100ac5761019d61040236610408565b916104b1565b60609060031901126100ac5760043563ffffffff811681036100ac57906024356001600160801b03811681036100ac57906044356001600160a01b03811681036100ac5790565b67ffffffffffffffff811161046357604052565b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff82111761046357604052565b908160209103126100ac575180151581036100ac5790565b604080516323b872dd60e01b81523360048201523060248201526001600160801b03841660448201526001600160a01b039491939060209081816064815f7f00000000000000000000000000000000000000000000000000000000000000008c165af1801561066257610645575b506001600160801b03855192630ea598cb60e41b845216600483015280826024815f8a7f0000000000000000000000000000000000000000000000000000000000000000165af190811561063b575f9161060b575b5061057f91506107f9565b937f000000000000000000000000000000000000000000000000000000000000000016803b156100ac578351632aba0cdd60e01b815263ffffffff90931660048401526001600160801b0390941660248301526001600160a01b03166044820152915f908390818381606481015b03925af19081156101a657506106005750565b6106099061044f565b565b905081813d8311610634575b6106218183610477565b810103126100ac5761057f90515f610574565b503d610617565b85513d5f823e3d90fd5b61065b90823d841161019f576101958183610477565b505f61051f565b86513d5f823e3d90fd5b604080516323b872dd60e01b81523360048201523060248201526001600160801b03841660448201526001600160a01b039491939060209081816064815f7f00000000000000000000000000000000000000000000000000000000000000008c165af18015610662576107dc575b506001600160801b03855192630ea598cb60e41b845216600483015280826024815f8a7f0000000000000000000000000000000000000000000000000000000000000000165af190811561063b575f916107ac575b5061073a91506107f9565b937f000000000000000000000000000000000000000000000000000000000000000016803b156100ac57835163db63588760e01b815263ffffffff90931660048401526001600160801b0390941660248301526001600160a01b03166044820152915f908390818381606481016105ed565b905081813d83116107d5575b6107c28183610477565b810103126100ac5761073a90515f61072f565b503d6107b8565b6107f290823d841161019f576101958183610477565b505f6106da565b6001600160801b039081811161080d571690565b60405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b6064820152608490fdfea2646970667358221220cf524fd673b7a6e06ba04f14d320fda32d0961a8fd8d0657139511f96391c20e64736f6c634300081800330000000000000000000000007a67d5eb2d6684d3e899575aaaa5ab31b79890c2000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe840000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0

Deployed Bytecode

0x604060808152600480361015610013575f80fd5b5f3560e01c9081631c05ddba146103f15781634aa07e64146103ae57816350dce3901461036b57816351a077a514610354578163846a0f23146101ec5781638ce43367146100b0575063c1fe3e481461006a575f80fd5b346100ac575f3660031901126100ac57517f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe846001600160a01b03168152602090f35b5f80fd5b9050346100ac57816003193601126100ac576001600160a01b03918135838116908190036100ac57815192636f074d1f60e11b84526024358185015260209485856024815f857f0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0165af19485156101e25790869392915f966101af575b50905f6044928651978895869463a9059cbb60e01b865285015260248401527f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe84165af19081156101a6575061017e57005b8161019d92903d1061019f575b6101958183610477565b810190610499565b005b503d61018b565b513d5f823e3d90fd5b848193959297503d83116101db575b6101c88183610477565b810103126100ac5751938592905f61012d565b503d6101be565b84513d5f823e3d90fd5b82346100ac576101fb36610408565b835163d7016ce360e01b815263ffffffff8085168783015291949293929160209182816024817f0000000000000000000000007a67d5eb2d6684d3e899575aaaa5ab31b79890c26001600160a01b03165afa9081156101e2575f9161031e575b5016600181036102725750505061019d935061066c565b60020361028557505061019d93506104b1565b85925081519180830183811067ffffffffffffffff82111761030b5781526002835261333960f01b838301525162461bcd60e51b81529283018190528151602484018190525f928492905b8285106102f2575050604492505f838284010152601f80199101168101030190fd5b84810182015186860160440152938101938593506102d0565b604185634e487b7160e01b5f525260245ffd5b90508281813d831161034d575b6103358183610477565b810103126100ac575181811681036100ac578861025b565b503d61032b565b346100ac5761019d61036536610408565b9161066c565b82346100ac575f3660031901126100ac57517f0000000000000000000000007a67d5eb2d6684d3e899575aaaa5ab31b79890c26001600160a01b03168152602090f35b82346100ac575f3660031901126100ac57517f0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca06001600160a01b03168152602090f35b346100ac5761019d61040236610408565b916104b1565b60609060031901126100ac5760043563ffffffff811681036100ac57906024356001600160801b03811681036100ac57906044356001600160a01b03811681036100ac5790565b67ffffffffffffffff811161046357604052565b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff82111761046357604052565b908160209103126100ac575180151581036100ac5790565b604080516323b872dd60e01b81523360048201523060248201526001600160801b03841660448201526001600160a01b039491939060209081816064815f7f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe848c165af1801561066257610645575b506001600160801b03855192630ea598cb60e41b845216600483015280826024815f8a7f0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0165af190811561063b575f9161060b575b5061057f91506107f9565b937f0000000000000000000000007a67d5eb2d6684d3e899575aaaa5ab31b79890c216803b156100ac578351632aba0cdd60e01b815263ffffffff90931660048401526001600160801b0390941660248301526001600160a01b03166044820152915f908390818381606481015b03925af19081156101a657506106005750565b6106099061044f565b565b905081813d8311610634575b6106218183610477565b810103126100ac5761057f90515f610574565b503d610617565b85513d5f823e3d90fd5b61065b90823d841161019f576101958183610477565b505f61051f565b86513d5f823e3d90fd5b604080516323b872dd60e01b81523360048201523060248201526001600160801b03841660448201526001600160a01b039491939060209081816064815f7f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe848c165af18015610662576107dc575b506001600160801b03855192630ea598cb60e41b845216600483015280826024815f8a7f0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0165af190811561063b575f916107ac575b5061073a91506107f9565b937f0000000000000000000000007a67d5eb2d6684d3e899575aaaa5ab31b79890c216803b156100ac57835163db63588760e01b815263ffffffff90931660048401526001600160801b0390941660248301526001600160a01b03166044820152915f908390818381606481016105ed565b905081813d83116107d5575b6107c28183610477565b810103126100ac5761073a90515f61072f565b503d6107b8565b6107f290823d841161019f576101958183610477565b505f6106da565b6001600160801b039081811161080d571690565b60405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b6064820152608490fdfea2646970667358221220cf524fd673b7a6e06ba04f14d320fda32d0961a8fd8d0657139511f96391c20e64736f6c63430008180033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

0000000000000000000000007a67d5eb2d6684d3e899575aaaa5ab31b79890c2000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe840000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0

-----Decoded View---------------
Arg [0] : _cegaEntry (address): 0x7a67D5Eb2D6684d3e899575aAAA5AB31b79890c2
Arg [1] : _stETH (address): 0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84
Arg [2] : _wstETH (address): 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000007a67d5eb2d6684d3e899575aaaa5ab31b79890c2
Arg [1] : 000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe84
Arg [2] : 0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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