Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/odradev/odra
Odra framework
https://github.com/odradev/odra
framework rust smart-contracts
Last synced: 3 days ago
JSON representation
Odra framework
- Host: GitHub
- URL: https://github.com/odradev/odra
- Owner: odradev
- License: mit
- Created: 2022-05-25T09:30:18.000Z (over 2 years ago)
- Default Branch: release/1.5.0
- Last Pushed: 2024-10-31T14:35:13.000Z (3 months ago)
- Last Synced: 2024-11-13T22:36:10.115Z (3 months ago)
- Topics: framework, rust, smart-contracts
- Language: Rust
- Homepage:
- Size: 16.9 MB
- Stars: 62
- Watchers: 7
- Forks: 2
- Open Issues: 56
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Security: SECURITY.md
- Roadmap: ROADMAP.md
Awesome Lists containing this project
README
![]()
Odra - Smart contracts for Casper Network.
Docs |
Installation |
Tutorials |
Cargo Odra |
Discord |
Blog
## Table of Contents
- [Usage](#usage)
- [Example](#example)
- [Tests](#tests)
- [Links](#links)
- [Contact](#contact)## Usage
Use [Cargo Odra](https://github.com/odradev/cargo-odra) to generate, build and test you code.
![]()
## Example
```rust
use odra::prelude::*;
use odra::Var;#[odra::module]
pub struct Flipper {
value: Var,
}#[odra::module]
impl Flipper {
pub fn init(&mut self) {
self.value.set(false);
}pub fn set(&mut self, value: bool) {
self.value.set(value);
}pub fn flip(&mut self) {
self.value.set(!self.get());
}pub fn get(&self) -> bool {
self.value.get_or_default()
}
}#[cfg(test)]
mod tests {
use crate::flipper::FlipperHostRef;
use odra::host::{Deployer, NoArgs};#[test]
fn flipping() {
let env = odra_test::env();
let mut contract = FlipperHostRef::deploy(&env, NoArgs);
assert!(!contract.get());
contract.flip();
assert!(contract.get());
}
}
```Checkout our [examples](https://github.com/odradev/odra/tree/HEAD/examples).
It shows most of Odra features.## Tests
Before running tests make sure you have following packages installed:
- Rust toolchain (see [rustup.rs](https://rustup.rs/)) with `wasm32-unknown-unknown` target.
- `cargo-odra` (see [Cargo Odra](https://github.com/odradev/cargo-odra))
- `just` (see [just](https://github.com/casey/just#packages))Run tests:
```bash
$ just test
```## Links
* [Odra Book - Docs and Tutorials](https://odra.dev/docs)
* [API Documentation](https://docs.rs/odra/latest/odra/)
* [Cargo Odra](https://github.com/odradev/cargo-odra)
* [Example Contracts](https://github.com/odradev/odra/tree/HEAD/examples)## Contact
Need some help? Write to **[email protected]**.