← Back to Registry
D-SAFE CERTIFIED

Inert Data-Well: ProjectManagerStorage.sol Audit

Inert Data-Well: ProjectManagerStorage.sol Audit

Audit Certificate: ProjectManagerStorage Data-Well

Issued by: D-Safe Internal Auditing

This technical briefing certifies the ProjectManagerStorage.sol contract, which implements a specialized architectural design pattern referred to as the Inert Data-Well. Under this paradigm, the contract functions exclusively as a high-capacity state repository for Pond Enterprise—it is imbued with extensive storage capabilities but devoid of any internal business logic.

By deliberately isolating logic from the storage layer, the protocol provides an institutional-grade security guarantee. Access control is strictly maintained via the onlyAuthorized modifier. This audit certifies how this passive storage model safeguards critical state data, such as the governance Credits earned via donations, which ultimately fund developer recruitment through the D-Library Competition.

D-CODE Sovereign Licence

Certified SourceCode

The following smart contract source code is published under the D-CODE Licence. This license enforces strict Open Code availability. Unlike Open Source, Open Code means the code is entirely public and auditable for maximum transparency, but it explicitly prohibits unauthorized modifications, derivations, or forks of the certified logic. It requires clear attribution to POND Enterprise.

// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.24;

import "./IProjectManagerStorage.sol";
import {ErrorLibrary} from "./ErrorLibrary.sol";

contract ProjectManagerStorage is IProjectManagerStorage {
    address public admin;
    mapping(address => bool) public isAuthorized;

    uint16 private _nbProjects;
    mapping(uint16 => Project) private projects;
    mapping(uint16 => uint16) private nbLanguages;
    mapping(uint16 => mapping(bytes4 => uint16)) private availableLanguagesToIndex;
    mapping(uint16 => mapping(uint16 => bytes4)) private availableLanguagesFromIndex;
    mapping(uint16 => mapping(bytes4 => mapping(uint16 => Version))) private versions;
    mapping(uint16 => mapping(bytes4 => uint16)) private nbVersions;
    mapping(uint16 => mapping(bytes4 => uint256)) private projectVotingBalances;
    mapping(uint16 => mapping(address => uint256)) private projectDonations;
    mapping(address => mapping(uint16 => uint256)) private donations;
    mapping(address => uint256[3]) private balances;
    mapping(uint256 => StripeDonation[]) private _weeklyDonations;

    modifier onlyAdmin() {
        require(msg.sender == admin, "not admin");
        _;
    }

    modifier onlyAuthorized() {
        require(isAuthorized[msg.sender] || msg.sender == admin, "not authorized");
        _;
    }

    constructor() {
        admin = msg.sender;
    }

    function addAuthorized(address caller) external onlyAdmin {
        isAuthorized[caller] = true;
    }

    function removeAuthorized(address caller) external onlyAdmin {
        isAuthorized[caller] = false;
    }

    // --- Read Methods ---
    function nbProjects() external view returns (uint16) { return _nbProjects; }
    function getProject(uint16 projectId) external view returns (uint16 id) { return projects[projectId].id; }
    function getNbLanguages(uint16 projectId) external view returns (uint16) { return nbLanguages[projectId]; }
    function getLanguageAtIndex(uint16 projectId, uint16 index) external view returns (bytes4) { return availableLanguagesFromIndex[projectId][index]; }
    function getLanguageIndex(uint16 projectId, bytes4 lang) external view returns (uint16) { return availableLanguagesToIndex[projectId][lang]; }
    function getNbVersions(uint16 projectId, bytes4 lang) external view returns (uint16) { return nbVersions[projectId][lang]; }
    function getVersion(uint16 projectId, bytes4 lang, uint16 versionNumber) external view returns (Version memory) { return versions[projectId][lang][versionNumber]; }
    function getVotingBalance(uint16 projectId, bytes4 lang) external view returns (uint256) { return projectVotingBalances[projectId][lang]; }
    function getUserProjectDonation(uint16 projectId, address user) external view returns (uint256) { return projectDonations[projectId][user]; }
    function getUserTotalDonationForProject(address user, uint16 projectId) external view returns (uint256) { return donations[user][projectId]; }
    function getUserBalances(address user) external view returns (uint256[3] memory) { return balances[user]; }

    function getWeeklyDonations(uint256 week) external view returns (StripeDonation[] memory) {
        return _weeklyDonations[week];
    }

    function getDonationsRange(uint256 fromWeek, uint256 toWeek) external view returns (StripeDonation[] memory) {
        uint256 totalCount = 0;
        for (uint256 w = fromWeek; w <= toWeek; w++) {
            totalCount += _weeklyDonations[w].length;
        }

        StripeDonation[] memory allDonations = new StripeDonation[](totalCount);
        uint256 index = 0;
        for (uint256 w = fromWeek; w <= toWeek; w++) {
            StripeDonation[] storage weekDonations = _weeklyDonations[w];
            for (uint256 i = 0; i < weekDonations.length; i++) {
                allDonations[index] = weekDonations[i];
                index++;
            }
        }
        return allDonations;
    }

    // --- Write Methods ---
    function incrementNbProjects() external onlyAuthorized returns (uint16) {
        _nbProjects++;
        return _nbProjects;
    }

    function setProject(uint16 projectId) external onlyAuthorized {
        projects[projectId] = Project(projectId);
    }

    function setNbLanguages(uint16 projectId, uint16 count) external onlyAuthorized {
        nbLanguages[projectId] = count;
    }

    function setLanguageMapping(uint16 projectId, bytes4 lang, uint16 index) external onlyAuthorized {
        availableLanguagesToIndex[projectId][lang] = index;
        availableLanguagesFromIndex[projectId][index] = lang;
    }

    function setNbVersions(uint16 projectId, bytes4 lang, uint16 count) external onlyAuthorized {
        nbVersions[projectId][lang] = count;
    }

    function setVersion(uint16 projectId, bytes4 lang, uint16 versionNumber, Version calldata version) external onlyAuthorized {
        versions[projectId][lang][versionNumber] = version;
    }

    function updateVotingBalance(uint16 projectId, bytes4 lang, uint256 amount, bool add) external onlyAuthorized {
        if (add) projectVotingBalances[projectId][lang] += amount;
        else projectVotingBalances[projectId][lang] -= amount;
    }

    function updateUserProjectDonation(uint16 projectId, address user, uint256 amount, bool add) external onlyAuthorized {
        if (add) projectDonations[projectId][user] += amount;
        else projectDonations[projectId][user] -= amount;
    }

    function updateUserTotalDonationForProject(address user, uint16 projectId, uint256 amount, bool add) external onlyAuthorized {
        if (add) donations[user][projectId] += amount;
        else donations[user][projectId] -= amount;
    }

    function updateUserBalances(address user, uint256[3] calldata newBalances) external onlyAuthorized {
        balances[user] = newBalances;
    }

    function recordStripeDonation(uint256 week, StripeDonation calldata donation) external onlyAuthorized {
        _weeklyDonations[week].push(donation);
    }
}

Build with Indestructible Infrastructure

Our D-SAFE certification ensures your smart contracts meet the highest standards of technical permanence and ethical safety.

Consult with our Architects