AstaVerde is a platform for trading verified carbon offsets as non-fungible tokens (NFTs). Built on Ethereum using the ERC-1155 standard, it employs a Dutch Auction mechanism for pricing carbon credit batches.
AstaVerde implements a dynamic pricing system for carbon credit tokens, combining elements of a Dutch auction with automatic price adjustments based on market demand.
-
Base Price: The starting point for new batches, adjusted based on market activity.
-
Batch Creation: Each batch starts at the current base price.
-
Price Decrease:
- Batch prices decrease over time, starting after a threshold period (
dayDecreaseThreshold
). - The decrease rate is controlled by
priceDelta
. - Prices never fall below the
priceFloor
.
- Batch prices decrease over time, starting after a threshold period (
-
Base Price Adjustments:
- Increases: If multiple batches sell out within
dayIncreaseThreshold
, the base price increases. - Decreases: If no sales occur for an extended period, the base price decreases.
- Adjustments are made in increments of
priceDelta
.
- Increases: If multiple batches sell out within
-
Independent Batch Pricing: Each batch's price is calculated independently based on its creation time.
-
Price Floor: A minimum price (
priceFloor
) below which no batch can be sold.
basePrice
: Starting price for new batchespriceFloor
: Minimum allowed pricepriceDelta
: Amount of price adjustment (increase or decrease)dayIncreaseThreshold
: Days within which batch sellouts trigger price increasesdayDecreaseThreshold
: Days of inactivity before price decreases begin
This system aims to balance supply and demand by adjusting prices based on market activity while maintaining independent pricing for each batch.
- Credit Producers: Generate and verify carbon offsets, listing them as NFTs.
- Platform Owner: Mints new batches of NFTs and manages the auction.
- Buyers: Bid on and purchase batches of NFTs.
- Node.js and npm
- MetaMask or another Ethereum wallet
- Docker (for deployment)
-
Clone the repository:
git clone git@github.com:orpheuslummis/AstaVerde.git cd AstaVerde
-
Install dependencies:
npm install
-
Set up environment variables:
cp .env.local.example .env.local cp ./webapp/.env.local.example ./webapp/.env.local
Edit
.env.local
andwebapp/.env.local
with your specific private values. -
Compile the contracts:
npm run compile
-
Start a local Hardhat node:
npm run node
-
In a new terminal, deploy contracts to the local network:
npm run deploy:local
-
Start the webapp in development mode:
npm run webapp:dev
-
(Optional) For automatic recompilation and redeployment on contract changes:
npm run watch:dev
-
(Optional) For local minting:
npm run task:mintlocal
With local hardhat node:
OWNER_ADDRESS=xyz p node
NODE_ENV=development p webapp:dev
OWNER_ADDRESS=0x... p deploy:testnet
- Install Docker Desktop from https://docs.docker.com/desktop/install/mac-install/
- Clone the repository:
git clone git@github.com:orpheuslummis/AstaVerde.git && cd AstaVerde
- To deploy: Configure and run
./deploy.sh
- To mint: Configure and run
./mint.sh
-
Deploy contract on testnet:
npm run test npm run compile && npm run postinstall npm run deploy:contracts -- --network base-sepolia
-
Set environment variables on Vercel:
- CHAIN_SELECTION
- ALCHEMY_API_KEY
- WALLET_CONNECT_PROJECT_ID
- Prepare a CSV file with token metadata and an image folder.
- Update the
.env.local
file with the correct paths. - Run
npm run task:mint
- Update values in
/scripts/events/index.mjs
. - Run
npm run task:events
When updating the contract, remember to update the contract address and ABI in:
webapp/src/lib/contracts.ts
scripts/events/contracts.mjs
.env.local
for minting scripts
This project is licensed under the MIT License - see the LICENSE file for details.
- The market can be paused if USDC becomes depegged.
- Always ensure your
.env.local
andwebapp/.env.local
files are up to date and never committed to the repository.