Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00Latest 25 from a total of 95 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Wrap And Add To ... | 19483512 | 715 days ago | IN | 0 ETH | 0.00070789 | ||||
| Wrap And Add To ... | 19481774 | 715 days ago | IN | 0 ETH | 0.0005968 | ||||
| Wrap And Add To ... | 19481768 | 715 days ago | IN | 0 ETH | 0.00058878 | ||||
| Wrap And Add To ... | 19440178 | 721 days ago | IN | 0 ETH | 0.00793863 | ||||
| Wrap And Add To ... | 19319400 | 738 days ago | IN | 0 ETH | 0.01115004 | ||||
| Wrap And Add To ... | 19291519 | 742 days ago | IN | 0 ETH | 0.01223483 | ||||
| Wrap And Add To ... | 19238314 | 749 days ago | IN | 0 ETH | 0.00135596 | ||||
| Wrap And Add To ... | 19237807 | 749 days ago | IN | 0 ETH | 0.00151198 | ||||
| Wrap And Add To ... | 19237704 | 749 days ago | IN | 0 ETH | 0.00180559 | ||||
| Wrap And Add To ... | 19237608 | 749 days ago | IN | 0 ETH | 0.0015693 | ||||
| Wrap And Add To ... | 19237592 | 749 days ago | IN | 0 ETH | 0.00151287 | ||||
| Wrap And Add To ... | 19159275 | 760 days ago | IN | 0 ETH | 0.00082306 | ||||
| Wrap And Add To ... | 19159262 | 760 days ago | IN | 0 ETH | 0.00074063 | ||||
| Wrap And Add To ... | 19158370 | 761 days ago | IN | 0 ETH | 0.00243071 | ||||
| Wrap And Add To ... | 19152295 | 761 days ago | IN | 0 ETH | 0.00091044 | ||||
| Wrap And Add To ... | 19152288 | 761 days ago | IN | 0 ETH | 0.00091761 | ||||
| Wrap And Add To ... | 19144672 | 763 days ago | IN | 0 ETH | 0.00688936 | ||||
| Wrap And Add To ... | 19137839 | 763 days ago | IN | 0 ETH | 0.00453294 | ||||
| Wrap And Add To ... | 19132882 | 764 days ago | IN | 0 ETH | 0.00415926 | ||||
| Wrap And Add To ... | 19132873 | 764 days ago | IN | 0 ETH | 0.00140489 | ||||
| Wrap And Add To ... | 19132860 | 764 days ago | IN | 0 ETH | 0.00150343 | ||||
| Wrap And Add To ... | 19131847 | 764 days ago | IN | 0 ETH | 0.00382818 | ||||
| Wrap And Add To ... | 19131157 | 764 days ago | IN | 0 ETH | 0.00142712 | ||||
| Wrap And Add To ... | 19129297 | 765 days ago | IN | 0 ETH | 0.00518741 | ||||
| Wrap And Add To ... | 19125368 | 765 days ago | IN | 0 ETH | 0.00139113 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
StETHWrappingProxy
Compiler Version
v0.8.17+commit.8df45f5f
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.17;
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol";
import { IDCSEntry } from "../cega-strategies/dcs/interfaces/IDCSEntry.sol";
import { IWrappingProxy } from "./interfaces/IWrappingProxy.sol";
import { IWstETH } from "./interfaces/IWstETH.sol";
contract StETHWrappingProxy is IWrappingProxy {
using SafeCast for uint256;
IDCSEntry public immutable cegaEntry;
IERC20 public immutable stETH;
IWstETH public immutable wstETH;
constructor(IDCSEntry _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(address(_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
) external {
stETH.transferFrom(msg.sender, address(this), amount);
uint128 wstETHAmount = wstETH.wrap(amount).toUint128();
cegaEntry.dcsAddToDepositQueue(productId, wstETHAmount, receiver);
}
}// 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);
}// 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);
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.17;
import { DCSProduct, DCSVault } from "./cega-strategies/dcs/DCSStructs.sol";
import { IOracleEntry } from "./oracle-entry/interfaces/IOracleEntry.sol";
uint32 constant DCS_STRATEGY_ID = 1;
struct DepositQueue {
uint128 queuedDepositsTotalAmount;
uint128 processedIndex;
mapping(address => uint128) amounts;
address[] depositors;
}
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;
mapping(uint32 => DepositQueue) dcsDepositQueues;
mapping(address => DCSVault) dcsVaults;
mapping(address => WithdrawalQueue) dcsWithdrawalQueues;
// vaultAddress => (timestamp => price)
mapping(address => mapping(uint40 => uint128)) oraclePriceOverride;
}
struct Vault {
uint128 totalAssets;
uint64 auctionWinnerTokenId;
uint16 yieldFeeBps;
uint16 managementFeeBps;
uint32 productId;
address auctionWinner;
uint40 tradeStartDate;
VaultStatus vaultStatus;
IOracleEntry.DataSource dataSource;
bool isInDispute;
}
enum VaultStatus {
DepositsClosed,
DepositsOpen,
NotTraded,
Traded,
TradeExpired,
FeesCollected,
WithdrawalQueueProcessed,
Zombie
}
struct MMNFTMetadata {
address vaultAddress;
uint40 tradeStartDate;
uint40 tradeEndDate;
uint16 aprBps;
uint128 notional;
uint128 initialSpotPrice;
uint128 strikePrice;
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.17;
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;
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;
}
struct DCSVault {
uint128 initialSpotPrice;
uint128 strikePrice;
uint128 totalYield;
uint16 aprBps;
SettlementStatus settlementStatus;
bool isPayoffInDepositAsset;
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.17;
import { Withdrawer, VaultStatus } from "../../../Structs.sol";
import {
DCSProductCreationParams,
DCSProduct,
SettlementStatus
} from "../DCSStructs.sol";
import {
IOracleEntry
} from "../../../oracle-entry/interfaces/IOracleEntry.sol";
interface IDCSBulkActionsEntry {
// FUNCTIONS
function dcsBulkStartTrades(
address[] calldata vaultAddresses
) external payable;
function dcsBulkOpenVaultDeposits(
address[] calldata vaultAddresses
) external;
function dcsBulkProcessDepositQueues(
address[] calldata vaultAddresses,
uint256 maxProcessCount
) external;
function dcsBulkProcessWithdrawalQueues(
address[] calldata vaultAddresses,
uint256 maxProcessCount
) external;
function dcsBulkRolloverVaults(address[] calldata vaultAddresses) external;
function dcsBulkCheckTradesExpiry(
address[] calldata vaultAddresses
) external;
function dcsBulkCheckAuctionDefault(
address[] calldata vaultAddresses
) external;
function dcsBulkCheckSettlementDefault(
address[] calldata vaultAddresses
) external;
function dcsBulkSettleVaults(
address[] calldata vaultAddresses
) external payable;
function dcsBulkCollectFees(address[] calldata vaultAddresses) external;
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.17;
interface IDCSConfigurationEntry {
// FUNCTIONS
function dcsSetLateFeeBps(uint16 lateFeeBps, uint32 productId) external;
function dcsSetMinDepositAmount(
uint128 minDepositAmount,
uint32 productId
) external;
function dcsSetMinWithdrawalAmount(
uint128 minWithdrawalAmount,
uint32 productId
) external;
function dcsSetIsDepositQueueOpen(
bool isDepositQueueOpen,
uint32 productId
) external;
function dcsSetDaysToStartLateFees(
uint32 productId,
uint8 daysToStartLateFees
) external;
function dcsSetDaysToStartAuctionDefault(
uint32 productId,
uint8 daysToStartAuctionDefault
) external;
function dcsSetDaysToStartSettlementDefault(
uint32 productId,
uint8 daysToStartSettlementDefault
) external;
function dcsSetMaxUnderlyingAmount(
uint128 maxUnderlyingAmountLimit,
uint32 productId
) external;
function dcsSetManagementFee(address vaultAddress, uint16 value) external;
function dcsSetYieldFee(address vaultAddress, uint16 value) external;
function dcsSetDisputePeriodInHours(
uint32 productId,
uint8 disputePeriodInHours
) external;
function setProductName(uint32 productId, string memory name) external;
function setTradeWinnerNftImage(
uint32 productId,
string memory imageUrl
) external;
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.17;
import { VaultStatus } from "../../../Structs.sol";
import { SettlementStatus } from "../DCSStructs.sol";
import { IDCSProductEntry } from "./IDCSProductEntry.sol";
import { IDCSVaultEntry } from "./IDCSVaultEntry.sol";
import { IDCSConfigurationEntry } from "./IDCSConfigurationEntry.sol";
import { IDCSBulkActionsEntry } from "./IDCSBulkActionsEntry.sol";
import {
IProductViewEntry
} from "../../../common/interfaces/IProductViewEntry.sol";
import {
IVaultViewEntry
} from "../../../common/interfaces/IVaultViewEntry.sol";
interface IDCSEntry is
IDCSProductEntry,
IDCSVaultEntry,
IDCSConfigurationEntry,
IDCSBulkActionsEntry,
IProductViewEntry,
IVaultViewEntry
{
// EVENTS
event DCSProductCreated(uint32 indexed productId);
event DepositQueued(
uint32 indexed productId,
address sender,
address receiver,
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 VaultStatusUpdated(
address indexed vaultAddress,
VaultStatus vaultStatus
);
event DCSSettlementStatusUpdated(
address indexed vaultAddress,
SettlementStatus settlementStatus
);
event DCSVaultFeesCollected(
address indexed vaultAddress,
uint128 totalFees,
uint128 managementFee,
uint128 yieldFee
);
event VaultCreated(
uint32 indexed productId,
address indexed vaultAddress,
string _tokenSymbol,
string _tokenName
);
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 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 DCSDaysToStartLateFeesUpdated(
uint32 indexed productId,
uint8 daysToStartLateFees
);
event DCSDaysToStartAuctionDefaultUpdated(
uint32 indexed productId,
uint8 daysToStartAuctionDefault
);
event DCSDaysToStartSettlementDefaultUpdated(
uint32 indexed productId,
uint8 daysToStartSettlementDefault
);
event ProductNameUpdated(uint32 indexed productId, string name);
event TradeWinnerNftImageUpdated(uint32 indexed productId, string imageUrl);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.17;
import { Withdrawer, VaultStatus } from "../../../Structs.sol";
import {
DCSProductCreationParams,
DCSProduct,
SettlementStatus
} from "../DCSStructs.sol";
import {
IOracleEntry
} from "../../../oracle-entry/interfaces/IOracleEntry.sol";
interface IDCSProductEntry {
// FUNCTIONS
function dcsGetProduct(
uint32 productId
) external view returns (DCSProduct memory);
function dcsGetProductDepositAsset(
uint32 productId
) external view returns (address);
function dcsGetDepositQueue(
uint32 productId
)
external
view
returns (
address[] memory depositors,
uint128[] memory amounts,
uint128 totalAmount
);
function dcsGetWithdrawalQueue(
address vaultAddress
)
external
view
returns (
Withdrawer[] memory withdrawers,
uint256[] memory amounts,
bool[] memory withProxy,
uint256 totalAmount
);
function dcsIsWithdrawalPossible(
address vaultAddress
) external view returns (bool);
function dcsCalculateVaultFinalPayoff(
address vaultAddress
) external view returns (uint128);
function dcsCreateProduct(
DCSProductCreationParams calldata creationParams
) external returns (uint32);
function dcsAddToDepositQueue(
uint32 productId,
uint128 amount,
address receiver
) external payable;
function dcsProcessDepositQueue(
address vault,
uint256 maxProcessCount
) external;
function dcsAddToWithdrawalQueue(
address vault,
uint128 sharesAmount,
uint32 nextProductId
) external;
function dcsAddToWithdrawalQueueWithProxy(
address vaultAddress,
uint128 sharesAmount
) external;
function dcsProcessWithdrawalQueue(
address vault,
uint256 maxProcessCount
) external;
function dcsCheckTradeExpiry(address vaultAddress) external;
function dcsCheckSettlementDefault(address vaultAddress) external;
function dcsCollectVaultFees(address vaultAddress) external;
function dcsSubmitDispute(address vaultAddress) external;
function dcsProcessTradeDispute(
address vaultAddress,
uint128 newPrice
) external;
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.17;
import { VaultStatus, Vault } from "../../../Structs.sol";
import { SettlementStatus, DCSVault } from "../DCSStructs.sol";
import {
IOracleEntry
} from "../../../oracle-entry/interfaces/IOracleEntry.sol";
interface IDCSVaultEntry {
// FUNCTIONS
function dcsGetVault(
address vaultAddress
) external view returns (DCSVault memory);
function dcsCalculateLateFee(
address vaultAddress
) external view returns (uint128);
function dcsGetCouponPayment(
address vaultAddress
) external view returns (uint128);
function dcsGetVaultSettlementAsset(
address vaultAddress
) external view returns (address);
function openVaultDeposits(address vaultAddress) external;
function setVaultStatus(
address vaultAddress,
VaultStatus _vaultStatus
) external;
function dcsCreateVault(
uint32 productId,
string memory _tokenName,
string memory _tokenSymbol
) external returns (address vaultAddress);
function dcsEndAuction(
address vaultAddress,
address _auctionWinner,
uint40 _tradeStartDate,
uint16 _aprBps,
IOracleEntry.DataSource dataSource
) external;
function dcsStartTrade(address vaultAddress) external payable;
function dcsSettleVault(address vaultAddress) external payable;
function dcsRolloverVault(address vaultAddress) external;
function dcsSetSettlementStatus(
address vaultAddress,
SettlementStatus _settlementStatus
) external;
function dcsSetIsPayoffInDepositAsset(
address vaultAddress,
bool newState
) external;
function dcsCheckAuctionDefault(address vaultAddress) external;
function overrideOraclePrice(
address vaultAddress,
uint40 timestamp,
uint128 newPrice
) external;
}// SPDX-License-Identifier: BUSL-1.1
import { ProductMetadata } from "../../Structs.sol";
pragma solidity ^0.8.17;
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);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.17;
import { Vault } 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 getIsDefaulted(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);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.17;
interface IOracleEntry {
enum DataSource {
None,
Pyth
}
event DataSourceAdapterSet(DataSource dataSource, address adapter);
/// @notice Gets `asset` price at `timestamp` in terms of USD using `dataSource`
function getSinglePrice(
address asset,
uint40 timestamp,
DataSource dataSource
) external view returns (uint128);
/// @notice Gets `baseAsset` price at `timestamp` in terms of `quoteAsset` using `dataSource`
function getPrice(
address baseAsset,
address quoteAsset,
uint40 timestamp,
DataSource dataSource
) external view returns (uint128);
/// @notice Sets data source adapter
function setDataSourceAdapter(
DataSource dataSource,
address adapter
) external;
function getTargetDecimals() external pure returns (uint8);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.17;
interface IWrappingProxy {
function unwrapAndTransfer(address receiver, uint256 amount) external;
function wrapAndAddToDCSDepositQueue(
uint32 productId,
uint128 amount,
address receiver
) external;
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.17;
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);
}{
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"details": {
"constantOptimizer": true,
"cse": true,
"deduplicate": true,
"inliner": true,
"jumpdestRemover": true,
"orderLiterals": true,
"peephole": true,
"yul": true,
"yulDetails": {
"optimizerSteps": "u",
"stackAllocation": true
}
},
"runs": 200
},
"remappings": [],
"viaIR": true,
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"contract IDCSEntry","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":"contract IDCSEntry","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":[],"name":"wstETH","outputs":[{"internalType":"contract IWstETH","name":"","type":"address"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60e06040523462000070575b62000020620000196200015d565b9162000215565b60405161086e62000344823960805181818161015c01526106b0015260a0518181816102c90152818161044b01526105c9015260c051818181610108015281816103dc015261063f015261086e90f35b62000079600080fd5b6200000b565b600080fd5b50634e487b7160e01b600052604160045260246000fd5b90601f01601f191681019081106001600160401b03821117620000bd57604052565b620000c762000084565b604052565b90620000e3620000db60405190565b92836200009b565b565b6001600160a01b031690565b90565b6001600160a01b0381165b036200007f57565b90505190620000e382620000f4565b90916060828403126200014e575b620000f162000134848462000107565b9362000144816020860162000107565b9360400162000107565b62000157600080fd5b62000124565b6200018062000bb2803803806200017481620000cc565b92833981019062000116565b909192565b620000f190620000e5906001600160a01b031682565b620000f19062000185565b620000f1906200019b565b801515620000ff565b90505190620000e382620001b1565b90620000f19160208183031215620001ba57620001e4600080fd5b620001ba565b6001600160a01b039091168152604081019291620000e39160200152565b506040513d6000823e3d90fd5b916200022f602092846080528060a0528260c052620001a6565b92620002b36000620002976200024a63095ea7b395620001a6565b936200027e878419809a62000271878b6200026460405190565b9687958694859360e01b90565b83528d60048401620001ea565b03925af1801562000333575b62000313575b50620001a6565b93620002bf620002a660405190565b9788968795869460e01b90565b845260048401620001ea565b03925af1801562000303575b620002d35750565b620002f89060203d8111620002fb575b620002ef81836200009b565b810190620001c9565b50565b503d620002e3565b6200030d62000208565b620002cb565b6200032d90883d8111620002fb57620002ef81836200009b565b62000290565b6200033d62000208565b6200028a56fe60806040526004361015610018575b610016600080fd5b005b60003560e01c80634aa07e641461007c57806350dce3901461007357806351a077a51461006a5780638ce43367146100615763c1fe3e480361000e5761005c6102b2565b61000e565b5061005c61028a565b5061005c610219565b5061005c610145565b5061005c6100f1565b600080fd5b600091031261009557565b61009d600080fd5b565b6100b3906100b6906001600160a01b031682565b90565b6001600160a01b031690565b6100b39061009f565b6100b3906100c2565b6100dd906100cb565b9052565b60208101929161009d91906100d4565b5034610138575b61010336600461008a565b6101347f00000000000000000000000000000000000000000000000000000000000000005b604051918291826100e1565b0390f35b610140600080fd5b6100f8565b5034610180575b61015736600461008a565b6101347f0000000000000000000000000000000000000000000000000000000000000000610128565b610188600080fd5b61014c565b63ffffffff81165b0361008557565b9050359061009d8261018d565b6001600160801b038116610195565b9050359061009d826101a9565b610195816100b6565b9050359061009d826101c5565b909160608284031261020c575b6100b36101f5848461019c565b9361020381602086016101b8565b936040016101ce565b610214600080fd5b6101e8565b5034610239575b61023461022e3660046101db565b916105b9565b604051005b610241600080fd5b610220565b80610195565b9050359061009d82610246565b91906100b39060408482031261027d575b61027481856101ce565b9360200161024c565b610285600080fd5b61026a565b50346102a5575b61023461029f366004610259565b906103d1565b6102ad600080fd5b610291565b50346102ed575b6102c436600461008a565b6101347f0000000000000000000000000000000000000000000000000000000000000000610128565b6102f5600080fd5b6102b9565b50634e487b7160e01b600052604160045260246000fd5b90601f01601f1916810190811067ffffffffffffffff82111761033357604052565b61033b6102fa565b604052565b9050519061009d82610246565b906100b3916020818303121561034057610365600080fd5b610340565b506040513d6000823e3d90fd5b801515610195565b9050519061009d82610377565b906100b3916020818303121561037f576103a4600080fd5b61037f565b6100dd906100b6565b91602061009d9294936103cd604082019660008301906103a9565b0152565b602061042e926104007f00000000000000000000000000000000000000000000000000000000000000006100cb565b610420600063de0e9a3e61041360405190565b9788958694859360e01b90565b835260048301526024820190565b03925af1918215610518575b6000926104e6575b5060209061046f7f00000000000000000000000000000000000000000000000000000000000000006100cb565b610492600063a9059cbb61049d61048560405190565b9788968795869460e01b90565b8452600484016103b2565b03925af180156104d9575b6104af5750565b6104cf9060203d81116104d2575b6104c78183610311565b81019061038c565b50565b503d6104bd565b6104e161036a565b6104a8565b602091925061050a90823d8111610511575b6105028183610311565b81019061034d565b9190610442565b503d6104f8565b61052061036a565b61043a565b6100b36100b36100b3926001600160801b031690565b6100dd90610525565b60409061056e61009d9496959396610564606084019860008501906103a9565b60208301906103a9565b019061053b565b60208101929161009d919061053b565b63ffffffff909116815260608101939261009d9290916040916105b2906001600160801b03166020830152565b01906103a9565b6106a661068d60206000946105ed7f00000000000000000000000000000000000000000000000000000000000000006100cb565b826323b872dd91339061061e8a610603306100cb565b956106298861061160405190565b9889978896879560e01b90565b855260048501610544565b03925af18015610783575b610768575b506106637f00000000000000000000000000000000000000000000000000000000000000006100cb565b6106828763ea598cb061067560405190565b9687958694859360e01b90565b835260048301610575565b03925af190811561075b575b849161073d575b50610814565b926106ee836106d47f00000000000000000000000000000000000000000000000000000000000000006100cb565b926106f963db63588791853b15610730575b604051610611565b855260048501610585565b03925af18015610723575b61070b5750565b61009d90600061071b8183610311565b81019061008a565b61072b61036a565b610704565b610738600080fd5b6106e6565b610755915060203d8111610511576105028183610311565b386106a0565b61076361036a565b610699565b61077e90833d81116104d2576104c78183610311565b610639565b61078b61036a565b610634565b60208082526027908201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316040820152663238206269747360c81b606082015260800190565b156107de57565b60405162461bcd60e51b8152806107f760048201610790565b0390fd5b6108086100b36100b39290565b6001600160801b031690565b6100b39061083361082b6001600160801b03610525565b8211156107d7565b6107fb56fea2646970667358221220c9c7938dd55549af1714eb501315420ce0484b7827d028934e7583a99b44cf8864736f6c634300081100330000000000000000000000007a67d5eb2d6684d3e899575aaaa5ab31b79890c2000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe840000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0
Deployed Bytecode
0x60806040526004361015610018575b610016600080fd5b005b60003560e01c80634aa07e641461007c57806350dce3901461007357806351a077a51461006a5780638ce43367146100615763c1fe3e480361000e5761005c6102b2565b61000e565b5061005c61028a565b5061005c610219565b5061005c610145565b5061005c6100f1565b600080fd5b600091031261009557565b61009d600080fd5b565b6100b3906100b6906001600160a01b031682565b90565b6001600160a01b031690565b6100b39061009f565b6100b3906100c2565b6100dd906100cb565b9052565b60208101929161009d91906100d4565b5034610138575b61010336600461008a565b6101347f0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca05b604051918291826100e1565b0390f35b610140600080fd5b6100f8565b5034610180575b61015736600461008a565b6101347f0000000000000000000000007a67d5eb2d6684d3e899575aaaa5ab31b79890c2610128565b610188600080fd5b61014c565b63ffffffff81165b0361008557565b9050359061009d8261018d565b6001600160801b038116610195565b9050359061009d826101a9565b610195816100b6565b9050359061009d826101c5565b909160608284031261020c575b6100b36101f5848461019c565b9361020381602086016101b8565b936040016101ce565b610214600080fd5b6101e8565b5034610239575b61023461022e3660046101db565b916105b9565b604051005b610241600080fd5b610220565b80610195565b9050359061009d82610246565b91906100b39060408482031261027d575b61027481856101ce565b9360200161024c565b610285600080fd5b61026a565b50346102a5575b61023461029f366004610259565b906103d1565b6102ad600080fd5b610291565b50346102ed575b6102c436600461008a565b6101347f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe84610128565b6102f5600080fd5b6102b9565b50634e487b7160e01b600052604160045260246000fd5b90601f01601f1916810190811067ffffffffffffffff82111761033357604052565b61033b6102fa565b604052565b9050519061009d82610246565b906100b3916020818303121561034057610365600080fd5b610340565b506040513d6000823e3d90fd5b801515610195565b9050519061009d82610377565b906100b3916020818303121561037f576103a4600080fd5b61037f565b6100dd906100b6565b91602061009d9294936103cd604082019660008301906103a9565b0152565b602061042e926104007f0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca06100cb565b610420600063de0e9a3e61041360405190565b9788958694859360e01b90565b835260048301526024820190565b03925af1918215610518575b6000926104e6575b5060209061046f7f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe846100cb565b610492600063a9059cbb61049d61048560405190565b9788968795869460e01b90565b8452600484016103b2565b03925af180156104d9575b6104af5750565b6104cf9060203d81116104d2575b6104c78183610311565b81019061038c565b50565b503d6104bd565b6104e161036a565b6104a8565b602091925061050a90823d8111610511575b6105028183610311565b81019061034d565b9190610442565b503d6104f8565b61052061036a565b61043a565b6100b36100b36100b3926001600160801b031690565b6100dd90610525565b60409061056e61009d9496959396610564606084019860008501906103a9565b60208301906103a9565b019061053b565b60208101929161009d919061053b565b63ffffffff909116815260608101939261009d9290916040916105b2906001600160801b03166020830152565b01906103a9565b6106a661068d60206000946105ed7f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe846100cb565b826323b872dd91339061061e8a610603306100cb565b956106298861061160405190565b9889978896879560e01b90565b855260048501610544565b03925af18015610783575b610768575b506106637f0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca06100cb565b6106828763ea598cb061067560405190565b9687958694859360e01b90565b835260048301610575565b03925af190811561075b575b849161073d575b50610814565b926106ee836106d47f0000000000000000000000007a67d5eb2d6684d3e899575aaaa5ab31b79890c26100cb565b926106f963db63588791853b15610730575b604051610611565b855260048501610585565b03925af18015610723575b61070b5750565b61009d90600061071b8183610311565b81019061008a565b61072b61036a565b610704565b610738600080fd5b6106e6565b610755915060203d8111610511576105028183610311565b386106a0565b61076361036a565b610699565b61077e90833d81116104d2576104c78183610311565b610639565b61078b61036a565b610634565b60208082526027908201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316040820152663238206269747360c81b606082015260800190565b156107de57565b60405162461bcd60e51b8152806107f760048201610790565b0390fd5b6108086100b36100b39290565b6001600160801b031690565b6100b39061083361082b6001600160801b03610525565b8211156107d7565b6107fb56fea2646970667358221220c9c7938dd55549af1714eb501315420ce0484b7827d028934e7583a99b44cf8864736f6c63430008110033
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
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.