SimpleDepositVault

Description:

Smart contract deployed on Ethereum with Factory features.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

{{
  "language": "Solidity",
  "sources": {
    "contracts/SimpleDepositVault.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

contract SimpleDepositVault {
    address public owner;
    uint256 public totalStaked;
    mapping(address => uint256) public balanceOf;

    event Deposited(address indexed user, uint256 amount);
    event WithdrawAllByOwner(uint256 amount, address to);

    modifier onlyOwner() {
        require(msg.sender == owner, "not owner");
        _;
    }

    constructor() {
        owner = msg.sender;
    }

    // 예치
    function deposit() external payable {
        require(msg.value > 0, "zero amount");
        balanceOf[msg.sender] += msg.value;
        totalStaked += msg.value;
        emit Deposited(msg.sender, msg.value);
    }

    // 오너가 전체 인출
    function withdrawAll(address payable to) external onlyOwner {
        uint256 amount = address(this).balance;
        require(amount > 0, "empty balance");
        (bool ok, ) = to.call{value: amount}("");
        require(ok, "transfer failed");
        totalStaked = 0; // 기록용 총합만 0으로
        emit WithdrawAllByOwner(amount, to);
    }
}
"
    }
  },
  "settings": {
    "optimizer": {
      "enabled": false,
      "runs": 200
    },
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    },
    "remappings": []
  }
}}

Tags:
Factory|addr:0xbd7d2302b36f3f2f7dd41a273f897eac271b3ab7|verified:true|block:23700853|tx:0x736c3e2d6c313f114387424e6163f67cc64f7177fb853c9fcc58ae6b67518e92|first_check:1761991710

Submitted on: 2025-11-01 11:08:30

Comments

Log in to comment.

No comments yet.