Commit 32efa54b authored by Robin Freyler's avatar Robin Freyler

[examples] lang2/Delegator: fix some warnings and added Delegator::get

parent 6b5ab413
fn main() -> Result<(), std::io::Error> {
let abi = contract::ink_generate_abi();
let abi = <contract::Delegator as ink_lang2::GenerateAbi>::generate_abi();
let contents = serde_json::to_string_pretty(&abi)?;
std::fs::create_dir("target").ok();
std::fs::write("target/abi.json", contents)?;
......
#!/usr/bin/env
#!/usr/bin/env bash
pushd accumulator && cargo contract build && popd &&
pushd adder && cargo contract build && popd &&
......
......@@ -94,6 +94,11 @@ mod delegator {
self.adder.set(adder.clone());
self.subber.set(subber.clone());
}
/// Returns the accumulator's value.
#[ink(message)]
fn get(&self) -> i32 {
self.accumulator.get().get()
}
/// Delegates the call to either `Adder` or `Subber`.
#[ink(message)]
......@@ -105,6 +110,7 @@ mod delegator {
}
/// Switches the delegator.
#[ink(message)]
fn switch(&mut self) {
match *self.which {
Which::Adder => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment