#![cfg_attr(not(feature = "std"), no_std)]
pub use self::accumulator::{
Accumulator,
AccumulatorRef,
};
use ink_lang as ink;
#[ink::contract]
pub mod accumulator {
#[ink(storage)]
pub struct Accumulator {
value: i32,
}
impl Accumulator {
#[ink(constructor)]
pub fn new(init_value: i32) -> Self {
Self { value: init_value }
}
#[ink(message)]
pub fn inc(&mut self, by: i32) {
self.value += by;
}
#[ink(message)]
pub fn get(&self) -> i32 {
self.value
}
}
}