Description:
Decentralized Finance (DeFi) protocol contract providing Factory functionality.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
{{
"language": "Solidity",
"sources": {
"contracts/Contract.sol": {
"content": "// SPDX-License-Identifier: ISC
pragma solidity ^0.8.0;
interface IStableVault {
function maxDeposit() external view returns (uint256);
function depositStart() external view returns (uint64);
function depositEnd() external view returns (uint64);
function operationalMode() external view returns (uint8);
function sharesNonKyc() external view returns (uint256);
function depositCap() external view returns (uint256);
}
/**
* @title DepositChecker
* @notice Utility contract to check if the deposit pool is open according to the vault's requirements
* @dev According to the analysis, the deposit pool is open when ALL of the following conditions are met:
* 1. operationalMode() == OperationalMode.Deposit (0)
* 2. block.timestamp >= depositStart()
* 3. block.timestamp <= depositEnd()
* 4. maxDeposit() > 0 (also checks deposit cap)
* maxDeposit() returns 0 if mode is not Deposit OR window is not open
* Otherwise returns the remaining capacity: _depositCap - sharesNonKyc
*/
contract DepositChecker {
IStableVault public immutable vault;
constructor(address vaultAddress) {
vault = IStableVault(vaultAddress);
}
/**
* @notice Checks if the deposit pool is currently open
* @return ready True if the pool is open and accepting deposits, false otherwise
* @dev Checks all four conditions required for the pool to be open:
* - Operational mode must be Deposit
* - Current time must be within deposit window
* - Max deposit must be greater than 0 (implies cap not reached and window open)
*/
function checkDepositReady(
uint256 assets
) external view returns (bool ready) {
uint256 maxDeposit = vault.maxDeposit();
return maxDeposit > 0 && assets <= maxDeposit;
}
/**
* @notice Returns detailed state information about the vault
* @return isOpen Whether the deposit pool is currently open
* @return mode Current operational mode
* @return currentTime Current block timestamp
* @return windowStart Deposit window start timestamp
* @return windowEnd Deposit window end timestamp
* @return maxDepositAmount Maximum amount that can be deposited (0 if closed)
* @return depositCap Deposit cap
* @return sharesNonKyc Number of shares that have been deposited
* @return remainingCapacity Remaining capacity
*/
function getVaultState()
external
view
returns (
bool isOpen,
uint8 mode,
uint64 currentTime,
uint64 windowStart,
uint64 windowEnd,
uint256 maxDepositAmount,
uint256 depositCap,
uint256 sharesNonKyc,
uint256 remainingCapacity
)
{
mode = vault.operationalMode();
windowStart = vault.depositStart();
windowEnd = vault.depositEnd();
maxDepositAmount = vault.maxDeposit();
currentTime = uint64(block.timestamp);
depositCap = vault.depositCap();
sharesNonKyc = vault.sharesNonKyc();
remainingCapacity = depositCap - sharesNonKyc;
isOpen = maxDepositAmount > 0;
}
}
"
}
},
"settings": {
"evmVersion": "paris",
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": [],
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}
}}
Submitted on: 2025-11-06 11:46:54
Comments
Log in to comment.
No comments yet.