Wildlife Protection Fund Contract

What it does:
Collects, manages, and distributes funds to wildlife conservation projects in a transparent, accountable, and community-governed way.

Why it matters:
Protects endangered species by ensuring donations are used as intended, reduces corruption in conservation funding, and builds public trust through on-chain transparency.

How it works:

  • Donors contribute funds to a wildlife protection pool

  • Conservation organizations submit funding requests

  • Approved auditors or DAO members review project legitimacy

  • Funds are released via smart contracts, optionally by milestones

  • Project impact reports are linked on-chain

  • Donors can track how their contributions are used

  • All funding activity remains transparent and auditable

      // SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/access/Ownable.sol";

/**
 * @title WildlifeProtectionFund
 * @author Nam
 * @notice Manages transparent funding for wildlife conservation projects
 */
contract WildlifeProtectionFund is Ownable {

    struct Project {
        address payable recipient;
        uint256 totalBudget;
        uint256 released;
        string projectURI; // IPFS: species, location, plan
        bool approved;
    }

    uint256 public projectCount;
    mapping(uint256 => Project) public projects;

    // -------------------- EVENTS --------------------

    event DonationReceived(address indexed donor, uint256 amount);
    event ProjectSubmitted(uint256 indexed projectId, address recipient);
    event ProjectApproved(uint256 indexed projectId);
    event FundsReleased(uint256 indexed projectId, uint256 amount);

    // -------------------- DONATIONS --------------------

    receive() external payable {
        emit DonationReceived(msg.sender, msg.value);
    }

    // -------------------- PROJECT SUBMISSION --------------------

    function submitProject(
        address payable _recipient,
        uint256 _budget,
        string calldata _projectURI
    ) external {
        require(_budget > 0, "Invalid budget");

        projectCount += 1;
        projects[projectCount] = Project({
            recipient: _recipient,
            totalBudget: _budget,
            released: 0,
            projectURI: _projectURI,
            approved: false
        });

        emit ProjectSubmitted(projectCount, _recipient);
    }

    // -------------------- APPROVAL --------------------

    function approveProject(uint256 _projectId) external onlyOwner {
        projects[_projectId].approved = true;
        emit ProjectApproved(_projectId);
    }

    // -------------------- FUND RELEASE --------------------

    function releaseFunds(uint256 _projectId, uint256 _amount) external onlyOwner {
        Project storage p = projects[_projectId];
        require(p.approved, "Project not approved");
        require(p.released + _amount = _amount, "Insufficient funds");

        p.released += _amount;
        p.recipient.transfer(_amount);

        emit FundsReleased(_projectId, _amount);
    }
}