Skip to content

Commit

Permalink
chore: change template for a riscv contract
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexD10S committed Oct 23, 2024
1 parent 06c6f56 commit a8edcef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/build/templates/new/_Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ authors = ["[your_name] <[your_email]>"]
edition = "2021"

[dependencies]
ink = { version = "5.0.0", default-features = false }
ink = { git = "https://github.com/r0gue-io/ink", branch = "sub0", default-features = false }
polkavm-derive = "0.11.0"

[dev-dependencies]
ink_e2e = { version = "5.0.0" }
Expand Down
3 changes: 3 additions & 0 deletions crates/build/templates/new/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ mod {{name}} {
impl {{camel_name}} {
/// Constructor that initializes the `bool` value to the given `init_value`.
#[ink(constructor)]
#[ink(payable)]
pub fn new(init_value: bool) -> Self {
Self { value: init_value }
}
Expand All @@ -31,12 +32,14 @@ mod {{name}} {
/// This one flips the value of the stored `bool` from `true`
/// to `false` and vice versa.
#[ink(message)]
#[ink(payable)]
pub fn flip(&mut self) {
self.value = !self.value;
}

/// Simply returns the current value of our `bool`.
#[ink(message)]
#[ink(payable)]
pub fn get(&self) -> bool {
self.value
}
Expand Down

0 comments on commit a8edcef

Please sign in to comment.