Vault

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/Vault.sol": {
      "content": "// SPDX-License-Identifier: MIT\r
pragma solidity ^0.8.24;\r
\r
/// @dev Minimal ERC-20 transfer used by this contract.\r
interface IERC20 {\r
    function transfer(address recipient, uint256 amount) external returns (bool);\r
}\r
\r
/// @dev Minimal interface for the Vault contract.\r
/// @notice Allows the Moon contract to instruct the Vault to release\r
///         a specified `amount` of `ray` to a given `member`.\r
interface IVault {\r
    function releaseToMember(address ray, uint256 amount, address member) external;\r
}\r
\r
/*──────────────────────────────  VAULT  ─────────────────────────────────*/\r
\r
/// @notice\r
/// A minimal vault that passively stores rays and releases them\r
/// to SUN members when instructed by the Moon contract.\r
contract Vault {\r
    /*//////////////////////////////////////////////////////////////////////\r
                                      STATE\r
    //////////////////////////////////////////////////////////////////////*/\r
\r
    /// Moon contract that is authorized to pull funds out of the vault.\r
    address public immutable moon;\r
\r
    /*//////////////////////////////////////////////////////////////////////\r
                                   CONSTRUCTOR\r
    //////////////////////////////////////////////////////////////////////*/\r
\r
    /// @param _moon The address of the Moon ERC‑20 contract.\r
    constructor(address _moon) {\r
        require(_moon != address(0), "Vault: zero Moon addr");\r
        moon = _moon;\r
    }\r
\r
    /*//////////////////////////////////////////////////////////////////////\r
                             CONTROLLED PAY‑OUT HOOK\r
    //////////////////////////////////////////////////////////////////////*/\r
    \r
    /// @notice Sends `amount` of `ray` to `member`.\r
    /// @dev Reverts if token reverts, returns false, or returns malformed data.\r
    ///      Zero-length return data is treated as success.\r
    function releaseToMember(\r
        address ray,\r
        uint256 amount,\r
        address member\r
    ) external {\r
        require(msg.sender == moon, "Vault: not MOON");\r
        require(member != address(0), "Vault: zero member");\r
\r
        (bool ok, bytes memory data) = ray.call(\r
            abi.encodeWithSelector(IERC20.transfer.selector, member, amount)\r
        );\r
\r
        // Token reverted → bubble as failure\r
        require(ok, "Vault: token transfer reverted");\r
\r
        // No return data → accept as success (supports non-standard tokens)\r
        if (data.length == 0) return;\r
\r
        // Must be exactly 32 bytes that decode to true\r
        require(data.length == 32 && abi.decode(data, (bool)), "Vault: token transfer failed");\r
    }\r
\r
}"
    }
  },
  "settings": {
    "evmVersion": "paris",
    "metadata": {
      "bytecodeHash": "ipfs"
    },
    "optimizer": {
      "enabled": true,
      "runs": 6000
    },
    "remappings": [],
    "viaIR": true,
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    }
  }
}}

Tags:
Factory|addr:0xffff33ad6ab86cfe721ddfe97eac10958240ffff|verified:true|block:23681219|tx:0x2274bf90c3cef8db745d0b8347a86f57affca8953f25db94f0b371845e7117a3|first_check:1761820361

Submitted on: 2025-10-30 11:32:17

Comments

Log in to comment.

No comments yet.