📄 Bouncer.sol
D-OPEN SOVEREIGN
1/*
2 * Copyright (c) 2026 DataPond D-Library Pty Ltd. ("The Sanctuary")
3 * Non-Profit Public Library — The World Library
4 * 
5 * D-SAFE Certification issued by POND Enterprise.
6 * Published under the D-Open Code Sovereign Licence v1.0 framework
7 * DataPond D-Library All exclusive Right reserved on modifiying the code - CC Attribution to data pond, Non modifiable, Non Commercial.
8 * https://registry.world.bibliotech.com/licence
9 * Source code donated to DataPond D-Library by it's author: data pond.
10 * 
11 * Technical Guardian ("The Shield"): Pond Enterprise Pty Ltd. (ACN 694 747 987)
12 * All liability claims about D-SAFE certification issues coming from the published D-Safe direction must be addressed with Pond Enterprise Pty Ltd.
13 * Code Modification automatically voids the certified liability protection provided by Pond Enterprise.
14 */
15
16// SPDX-License-Identifier: Apache-2.0
17pragma solidity ^0.8.24;
18
19import "./IBouncerStorage.sol";
20import {Identity} from "./Identity.sol";
21import {Ownable} from "./Ownable.sol";
22import {ErrorLibrary} from "./ErrorLibrary.sol";
23
24abstract contract Bouncer is Ownable{
25    IBouncerStorage public bouncerStorage;
26
27    // ... existing code ...
28
29    constructor()  {
30        // storage must be set by the deployer/owner after deployment
31    }
32
33    // ===== Admin =====
34    function setStorage(address storageAddr) public onlyOwner {
35        if (storageAddr == address(0) ) {
36            revert ErrorLibrary.EmptyAddress();
37        }
38        bouncerStorage = IBouncerStorage(storageAddr);
39    }
40
41    function userInfos(address addr) public view  returns (string memory username, string memory country, string memory language, uint32 newUserId) {
42        return bouncerStorage.userInfos(addr);
43    }
44
45
46    function usernameToUserId(string calldata username) public view  returns (uint32) {
47        return bouncerStorage.usernameToUserId(username);
48    }
49
50    function hasAccount(address addr) public view  returns (bool ok) {
51        return bouncerStorage.hasAccount(addr);
52    }
53    // ===== Lifecycle =====
54    function unregister() public {
55        if (!bouncerStorage.hasAccount(msg.sender)) revert ErrorLibrary.ErrNoAccount();
56        bouncerStorage.unregister(msg.sender);
57    }
58
59
60}