What it does:
Pools funds to support pandemic response efforts such as vaccine distribution, medical supplies, and emergency healthcare services.
Why it matters:
Enables rapid, transparent allocation of resources during health crises, ensures funds reach verified responders, and reduces administrative delays.
How it works:
Donors contribute funds to the pandemic response pool
Authorized agencies or hospitals register for fund access
Agencies submit requests with purpose and required amount
DAO members or admin approve fund disbursement
Smart contract releases funds automatically once approved
Spending and milestones are tracked on-chain
Unused funds can be returned to the pool or reallocated
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
/**
* @title PandemicResponseFund
* @author Nam
* @notice Emergency fund management for pandemic response
*/
contract PandemicResponseFund {
// -------------------- ROLES --------------------
address public admin;
uint256 public requestCount;
// -------------------- STRUCTS --------------------
struct FundRequest {
address agency;
string purpose;
uint256 amount;
bool approved;
bool executed;
}
// -------------------- STORAGE --------------------
mapping(uint256 => FundRequest) public requests;
// -------------------- EVENTS --------------------
event Funded(address indexed donor, uint256 amount);
event RequestSubmitted(uint256 indexed requestId, address indexed agency, string purpose, uint256 amount);
event RequestApproved(uint256 indexed requestId);
event FundsDisbursed(uint256 indexed requestId, uint256 amount);
// -------------------- MODIFIERS --------------------
modifier onlyAdmin() {
require(msg.sender == admin, "Not admin");
_;
}
// -------------------- CONSTRUCTOR --------------------
constructor() {
admin = msg.sender;
}
// -------------------- FUNDING --------------------
/**
* @notice Donate to the pandemic fund
*/
function donate() external payable {
require(msg.value > 0, "No funds sent");
emit Funded(msg.sender, msg.value);
}
// -------------------- FUND REQUESTS --------------------
/**
* @notice Submit a fund request
*/
function submitRequest(string calldata _purpose, uint256 _amount) external {
require(_amount > 0, "Invalid amount");
requestCount += 1;
requests[requestCount] = FundRequest({
agency: msg.sender,
purpose: _purpose,
amount: _amount,
approved: false,
executed: false
});
emit RequestSubmitted(requestCount, msg.sender, _purpose, _amount);
}
/**
* @notice Approve a fund request
*/
function approveRequest(uint256 _requestId) external onlyAdmin {
FundRequest storage r = requests[_requestId];
require(!r.approved, "Already approved");
r.approved = true;
emit RequestApproved(_requestId);
}
/**
* @notice Disburse funds for an approved request
*/
function disburseFunds(uint256 _requestId) external onlyAdmin {
FundRequest storage r = requests[_requestId];
require(r.approved, "Not approved");
require(!r.executed, "Already executed");
require(address(this).balance >= r.amount, "Insufficient balance");
r.executed = true;
payable(r.agency).transfer(r.amount);
emit FundsDisbursed(_requestId, r.amount);
}
// -------------------- FUNDING RECEIVED --------------------
receive() external payable {}
}
Build and Grow By Nam Le Thanh