Distribute reward with sustainability proofs
As the x2Earn ecosystem continues to evolve, developers must provide verifiable proof each time they reward a user. This requirement enhances transparency, trust, and accountability within the ecosystem. Below, we outline the standardized process for developers to follow when distributing rewards.
You can technically avoid providing proof, but this will have a bad impact on your reputation and could lead to expulsion from VeBetterDAO.
The proof will be stored on-chain in the form of an emitted event and will have the following JSON format:
Proofs
You can attach proof of the user's sustainable action when you distribute the reward. The proof can be a link, video, photo, and text. You can provide more than one proof (eg: a photo and a link).
The current proof types supported are:
Impacts
Determining the environmental impact of each sustainable action will require the development of a set of criteria and metrics for each type of action.
Categories
Carbon Footprint Reduction Key:
carbon
Description: Measures the decrease in greenhouse gas emissions. Metric: Grams (g) of CO2 equivalent reduced or removed.Resource Conservation Key:
water
(for water conservation),energy
(for electricity conservation) Description: Assesses the reduction in the use of natural resources like water, electricity, and raw materials. Metric: Milliliters (ml) of water saved, watt-hours (Wh) of electricity saved.Waste Reduction Key:
waste_mass
Description: Evaluates the decrease in waste generated and improves waste management. Metric: Grams (g) of waste diverted from landfills, number of items recycled.Timber Conservation Key:
timber
Description: Measures the reduction in the use or waste of timber resources. Metric: Grams (g) of timber saved.Plastic Reduction Key:
plastic
Description: Evaluates the decrease in the use or waste of plastic materials. Metric: Grams (g) of plastic saved or reduced.Education Time Key:
education_time
Description: Measures the amount of time a user spends learning about a sustainability topic. Metric: Seconds spent learning.Trees Planted Key:
trees_planted
Description: Tracks the number of trees planted as part of sustainability efforts. Metric: Number of trees planted.Calories Burned Key:
calories_burned
Description: Measures the energy expenditure from physical activity or exercise, promoting health and sustainability. Metric: Calories (kcal) burned.Sleep Quality Key:
sleep_quality_percentage
Description: Assesses the quality of sleep as a percentage, encouraging better health and productivity. Metric: Percentage (%) of sleep quality improvement.Clean Energy Production Key:
clean_energy_production_wh
Description: Measures the amount of clean energy produced, contributing to sustainable energy solutions. Metric: Watt-hours (Wh) of clean energy generated.
The following are the impact codes you will need to use:
We ask each app to find a way to calculate the impact they are having based on the previously listed categories. If your app does not fit in any of the above categories please feel free to submit your own category and impact definition.
Integration
To provide proofs and impacts you need to distribute the rewards through the X2EarnRewardsPool contract with the following function:
Apart from the usual appId, amount, and receiver fields you have 5 additional parameters that will allow the X2EarnRewardsPool contract to build the JSON proof and emit it through an event. Those parameters are:
proofTypes: an array with the proof types that you are providing. Eg:
["link", "image"]
proofValues: an array with the values of the types provided in the previous array. Eg:
["https://twitter.com/tweet/1233121231", "https://whatever.com/image.png"]
impactCodes: an array with the codes of impacts you are providing. Eg:
["water", "timber"]
impactValues: an array with the values of the impacts provided in the previous array. Eg:
[1000, 23]
description: you can attach also a description to your action, it's optional.
When calling this function it is mandatory to provide at least proof or impact, if none of them is provided then the transaction will revert.
The transaction will revert also if something is wrong with the data you pass.
Warning: the impact values MUST be a number and the unit is considered the default minimum (so milliliters, grams, wh, etc.). So if you saved 1 litter of water then you should put it as an impact of "water" : "1000"
.
Examples
Solidity
1) Import the latest interface
2) Distribute the rewards with proof
Example of providing both proof and impact
Example of providing only proof with no impact
Javascript + SDK
As a first thing get the ABI of the X2EarnRewardsPool contract from here.
Deprecated template (version 1)
If no "version" field is found in the the json proof then you should consider it as version 1.
Deprecated impacts:
Last updated