creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "src/Ownable.sol": {
        "content": "// SPDX-License-Identifier: SEE LICENSE IN LICENSE\npragma solidity 0.8.25;\n\nabstract contract Ownable {\n    address private _owner;\n\n    /// The caller account is not authorized to perform an operation.\n    error OwnableUnauthorizedAccount(address account);\n\n    event OwnershipTransferred(\n        address indexed oldOwner,\n        address indexed newOwner\n    );\n\n    /// @dev The owner is not a valid owner account.\n    error OwnableInvalidOwner(address owner);\n\n    constructor() {\n        _transferOwnership(msg.sender);\n    }\n\n    /// @dev Throws if called by any account other than the owner.\n    modifier onlyOwner() {\n        _checkOwner();\n        _;\n    }\n\n    /// @dev Returns the address of the current owner.\n    function owner() public view returns (address) {\n        return _owner;\n    }\n\n    /// @dev Throws if the sender is not the owner.\n    function _checkOwner() internal view {\n        if (owner() != msg.sender) {\n            revert OwnableUnauthorizedAccount(msg.sender);\n        }\n    }\n\n    /// @dev Transfers ownership of the contract to a new account (`newOwner`).\n    /// Can only be called by the current owner.\n    function transferOwnership(address newOwner) public onlyOwner {\n        _transferOwnership(newOwner);\n    }\n\n    /// @dev Transfers ownership of the contract to a new account (`newOwner`).\n    /// Internal function without access restriction.\n    function _transferOwnership(address newOwner) internal {\n        address oldOwner = _owner;\n        _owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n}\n"
      },
      "src/Wallets.sol": {
        "content": "// SPDX-License-Identifier: SEE LICENSE IN LICENSE\npragma solidity 0.8.25;\n\nimport {Ownable} from './Ownable.sol';\nimport {UsingReentrancyGuard} from './Wallets/ReentrancyGuard.sol';\n\ncontract Wallets is UsingReentrancyGuard {\n    mapping(address account => uint amount) balances;\n\n    event Credit(address indexed account, uint amount);\n    event Debit(address indexed account, uint amount);\n\n    error InsufficientFunds();\n\n    receive() external payable {\n        _credit(msg.sender, msg.value);\n    }\n\n    /// @notice Credits account. You can credit someone using this.\n    function creditAccount(address account) external payable {\n        _credit(account, msg.value);\n    }\n\n    /// @notice Credits your account.\n    function credit() external payable {\n        _credit(msg.sender, msg.value);\n    }\n\n    /// @dev Credits accounts specified here\n    function creditAccounts(address[] calldata accounts) external payable {\n        uint amount = msg.value;\n        uint accountsLength = accounts.length;\n        require(amount % accountsLength == 0);\n        uint amountForEachAccount = amount / accountsLength;\n        for (uint i; i < accountsLength; ) {\n            _credit(accounts[i], amountForEachAccount);\n            unchecked {\n                ++i;\n            }\n        }\n    }\n\n    /// @notice Same behavior as `creditAccounts` but credits\n    /// `manyAccounts` using `amountForEachManyAccount` and\n    /// `oneAccount` using `amountForOneAccount`\n    function creditManyAndOne(\n        address[] calldata manyAccounts,\n        uint amountForEachManyAccount,\n        address oneAccount,\n        uint amountForOneAccount\n    ) external payable {\n        uint manyAccountsLength = manyAccounts.length;\n        require(\n            (amountForEachManyAccount * manyAccountsLength) +\n                amountForOneAccount ==\n                msg.value\n        );\n\n        for (uint i; i < manyAccountsLength; ) {\n            _credit(manyAccounts[i], amountForEachManyAccount);\n            unchecked {\n                ++i;\n            }\n        }\n\n        _credit(oneAccount, amountForOneAccount);\n    }\n\n    /// @notice Allows withdrawing a specified amount from your wallet balance\n    function withdraw(uint amount) external nonReentrant {\n        address account = msg.sender;\n        uint balance = balances[account];\n        if (balance < amount) {\n            revert InsufficientFunds();\n        }\n        balances[account] -= amount;\n\n        _pay(account, amount);\n\n        emit Debit(account, amount);\n    }\n\n    /// @notice Allows withdrawing all amount from your wallet balance\n    function withdrawAll() external nonReentrant {\n        address account = msg.sender;\n        uint balance = balances[account];\n        if (balance == 0) {\n            revert InsufficientFunds();\n        }\n        balances[account] = 0;\n\n        _pay(account, balance);\n\n        emit Debit(account, balance);\n    }\n\n    /// @notice returns the balance of a wallet account\n    function getBalance(address account) external view returns (uint) {\n        return balances[account];\n    }\n\n    /// @notice returns the balance of this wallet contract in wei\n    function getTotalBalance() external view returns (uint) {\n        return address(this).balance;\n    }\n\n    function _credit(address account, uint amount) private {\n        balances[account] += amount;\n        emit Credit(account, amount);\n    }\n\n    function _pay(address to, uint256 amount) private {\n        (bool sent, ) = to.call{value: amount}('');\n        require(sent);\n    }\n}\n"
      },
      "src/Wallets/ReentrancyGuard.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\n\npragma solidity 0.8.25;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract UsingReentrancyGuard {\n    // Booleans are more expensive than uint256 or any type that takes up a full\n    // word because each write operation emits an extra SLOAD to first read the\n    // slot's contents, replace the bits taken up by the boolean, and then write\n    // back. This is the compiler's defense against contract upgrades and\n    // pointer aliasing, and it cannot be disabled.\n\n    // The values being non-zero value makes deployment a bit more expensive,\n    // but in exchange the refund on every call to nonReentrant will be lower in\n    // amount. Since refunds are capped to a percentage of the total\n    // transaction's gas, it is best to keep them low in cases like this one, to\n    // increase the likelihood of the full refund coming into effect.\n    uint256 private constant _NOT_ENTERED = 1;\n    uint256 private constant _ENTERED = 2;\n\n    uint256 private _status;\n\n    /**\n     * @dev Unauthorized reentrant call.\n     */\n    error ReentrancyGuardReentrantCall();\n\n    constructor() {\n        _status = _NOT_ENTERED;\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and making it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        _nonReentrantBefore();\n        _;\n        _nonReentrantAfter();\n    }\n\n    function _nonReentrantBefore() private {\n        // On the first call to nonReentrant, _status will be _NOT_ENTERED\n        if (_status == _ENTERED) {\n            revert ReentrancyGuardReentrantCall();\n        }\n\n        // Any calls to nonReentrant after this point will fail\n        _status = _ENTERED;\n    }\n\n    function _nonReentrantAfter() private {\n        // By storing the original value once again, a refund is triggered (see\n        // https://eips.ethereum.org/EIPS/eip-2200)\n        _status = _NOT_ENTERED;\n    }\n\n    /**\n     * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n     * `nonReentrant` function in the call stack.\n     */\n    function _reentrancyGuardEntered() internal view returns (bool) {\n        return _status == _ENTERED;\n    }\n}\n"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": true,
        "runs": 1000
      },
      "evmVersion": "paris",
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "metadata": {
        "useLiteralContent": true
      },
      "libraries": {}
    }
  }}