Green Transport Incentive Contract
What it does:
Rewards individuals and organizations for using eco-friendly transportation methods such as public transit, cycling, electric vehicles, and carpooling.
Why it matters:
Encourages behavioral change toward low-emission transport, reduces urban pollution, and creates a transparent incentive system aligned with climate goals.
How it works:
-
Approved verifiers (apps, IoT devices, oracles) submit green transport activity data
-
Users earn reward points or tokens based on distance, frequency, or emission savings
-
Smart contract validates submissions and records activity on-chain
-
Rewards are minted or distributed automatically
-
Anti-fraud rules limit duplicate or exaggerated claims
-
All activity and rewards are auditable and transparent
-
Can integrate with city programs, carbon offset systems, or employer benefits
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/**
* @title GreenTransportIncentive
* @author Nam
* @notice Incentivizes eco-friendly transportation through on-chain rewards
*/
contract GreenTransportIncentive is Ownable {
IERC20 public rewardToken;
struct Activity {
uint256 distance; // in meters
uint256 timestamp;
bool rewarded;
}
mapping(address => Activity[]) public userActivities;
mapping(address => bool) public approvedVerifiers;
uint256 public rewardRate; // tokens per km (1000 meters)
// -------------------- EVENTS --------------------
event VerifierApproved(address verifier);
event ActivitySubmitted(address indexed user, uint256 distance);
event RewardPaid(address indexed user, uint256 amount);
// -------------------- CONSTRUCTOR --------------------
constructor(address _rewardToken, uint256 _rewardRate) {
rewardToken = IERC20(_rewardToken);
rewardRate = _rewardRate;
}
// -------------------- VERIFIER MANAGEMENT --------------------
function approveVerifier(address _verifier) external onlyOwner {
approvedVerifiers[_verifier] = true;
emit VerifierApproved(_verifier);
}
// -------------------- ACTIVITY SUBMISSION --------------------
function submitActivity(address _user, uint256 _distance) external {
require(approvedVerifiers[msg.sender], "Not authorized verifier");
require(_distance > 0, "Invalid distance");
userActivities[_user].push(Activity({
distance: _distance,
timestamp: block.timestamp,
rewarded: false
}));
emit ActivitySubmitted(_user, _distance);
}
// -------------------- REWARD CLAIM --------------------
function claimRewards() external {
Activity[] storage activities = userActivities[msg.sender];
uint256 totalReward = 0;
for (uint256 i = 0; i 0, "No rewards available");
require(rewardToken.balanceOf(address(this)) >= totalReward, "Insufficient rewards");
rewardToken.transfer(msg.sender, totalReward);
emit RewardPaid(msg.sender, totalReward);
}
}