Welcome to the DeVolt Solana Programs repository! This collection of Solana program powers the DeVolt platform, enabling decentralized energy management and auctioning functionalities.
DeVolt's Solana programs offer a robust infrastructure for managing energy-related transactions on the blockchain. These contracts are essential for supporting the platform's dynamic and user-focused features.
To set up your local development environment, follow these steps.
- Install Rust: https://www.rust-lang.org/tools/install
- Install Solana CLI: https://docs.solana.com/cli/install-solana-cli-tools
- Install Anchor: https://www.anchor-lang.com/
Clone the repository and build the program:
git clone https://github.com/devolthq/solana-programs.git
cd solana-programs
anchor build
Find the program within the programs/devolt/src
directory, with detailed functionalities outlined as follows.
The battery_report
program allows stations to submit updates on the status of their batteries. This information is critical for the efficient management of energy within the DeVolt platform.
Located at: programs/devolt/src/instructions/battery_report.rs
.
Functionalities:
- Authenticates the station with the signer's key.
- Updates the station's data, such as identification and battery status.
- Concludes auctions based on the current time and selects winning bids.
- Automatically creates new auctions when the station reaches a certain energy deficit.
This program is a vital part of DeVolt's business logic, ensuring that the supply and demand for energy are met efficiently and transparently.
The place_bid
program is designed to allow bidders to make offers in energy auctions on the DeVolt platform.
Located at: programs/devolt/src/instructions/place_bid.rs
.
Functionalities:
- Allows bidders to place bids in energy auctions.
- Registers the bid with bidder information, the desired amount of energy, and the offered price.
- Stores the bids in the station's account for evaluation upon auction conclusion.
This program ensures that the auction process is conducted fairly and orderly, allowing the station to find the best available energy offers.
Build the program and update the TypeScript SDK types with:
yarn build
Followed by:
yarn update-types
Run tests with the following command:
cd sdk
Then:
yarn
And finally:
yarn start
Useful scripts for development are located in the package.json
files:
lint:fix
- Auto-fix and format code with Prettier.lint
- Check the code formatting with Prettier.update-types
- Update the TypeScript SDK types after building.build
- Build contracts and update SDK types.anchor-tests
- Run tests for the program.
Contributions are welcome! Please read CONTRIBUTING.md for the contribution process.
This project is under the ISC license for root directory code and MIT license for the SDK. See the LICENSE.md file in the respective directories for details.
For more information on Anchor, the framework used for DeVolt program, visit the official Anchor documentation.