Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improvements peter/feat-revive branch #1780

Merged
merged 2 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
17 changes: 17 additions & 0 deletions crates/extrinsics/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ use contract_transcode::{
use anyhow::Result;
use ink_env::Environment;
use scale_info::form::PortableForm;
use sp_core::H160;
use std::{
fmt::{
Display,
Expand Down Expand Up @@ -311,6 +312,22 @@ impl DisplayEvents {
.to_string();
}
}
if field.type_name == Some("H160".to_string()) {
// Value is in the format: H160([bytes])
// Extract the byte array between the brackets and convert it to a
// hexadecimal string
if let (Some(start), Some(end)) =
(value.find('['), value.find(']'))
{
let byte_str = &value[start + 1..end];
let bytes: Vec<u8> = byte_str
.split(", ")
.filter_map(|s| s.parse::<u8>().ok())
.collect();
let h160_value = H160::from_slice(&bytes);
value = format!("0x{}", hex::encode(h160_value.as_bytes()));
}
}
let _ = writeln!(
out,
"{:width$}{}: {}",
Expand Down
Loading