Use Cargo Odra to generate, build and test you code.
use odra::Variable;
#[odra::module]
pub struct Flipper {
value: Variable<bool>,
}
#[odra::module]
impl Flipper {
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 super::FlipperDeployer;
#[test]
fn flipping() {
let mut contract = FlipperDeployer::default();
assert_eq!(contract.get(), false);
contract.flip();
assert_eq!(contract.get(), true);
}
}
Checkout our examples. It shows most of Odra features.
Odra is designed to integrate with most WebAssembly-based smart contract systems.
Integrated blockchains:
- Casper Network.
Before running tests make sure you have following packages installed:
- Rust toolchain (see rustup.rs) with
wasm32-unknown-unknown
target. wasm-strip
(see wabt)cargo-odra
(see Cargo Odra)just
(see just)
Run tests:
$ just test
Need some help? Write to [email protected].