Skip to content

Commit

Permalink
fix old abi gen of examples (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
bxq2011hust committed Apr 2, 2022
1 parent 27336f4 commit 43afa18
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 20 deletions.
5 changes: 1 addition & 4 deletions examples/contract/ballot/.liquid/abi_gen/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ fn main() -> Result<(), std::io::Error> {

let target_dir = env::var("CARGO_TARGET_DIR").unwrap_or("target".into());
std::fs::create_dir(&target_dir).ok();
std::fs::write(
format!("{}/ballot.abi", target_dir),
serde_json::to_string(&abi).unwrap(),
)?;
std::fs::write("ballot.abi", serde_json::to_string(&abi).unwrap())?;
Ok(())
}
5 changes: 1 addition & 4 deletions examples/contract/erc20/.liquid/abi_gen/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ fn main() -> Result<(), std::io::Error> {

let target_dir = env::var("CARGO_TARGET_DIR").unwrap_or("target".into());
std::fs::create_dir(&target_dir).ok();
std::fs::write(
format!("{}/erc20.abi", target_dir),
serde_json::to_string(&abi).unwrap(),
)?;
std::fs::write("erc20.abi", serde_json::to_string(&abi).unwrap())?;
Ok(())
}
5 changes: 1 addition & 4 deletions examples/contract/incrementer/.liquid/abi_gen/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ fn main() -> Result<(), std::io::Error> {

let target_dir = env::var("CARGO_TARGET_DIR").unwrap_or("target".into());
std::fs::create_dir(&target_dir).ok();
std::fs::write(
format!("{}/incrementer.abi", target_dir),
serde_json::to_string(&abi).unwrap(),
)?;
std::fs::write("incrementer.abi", serde_json::to_string(&abi).unwrap())?;
Ok(())
}
5 changes: 1 addition & 4 deletions examples/contract/sum-1/.liquid/abi_gen/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ fn main() -> Result<(), std::io::Error> {

let target_dir = env::var("CARGO_TARGET_DIR").unwrap_or("target".into());
std::fs::create_dir(&target_dir).ok();
std::fs::write(
format!("{}/sum-1.abi", target_dir),
serde_json::to_string(&abi).unwrap(),
)?;
std::fs::write("sum-1.abi", serde_json::to_string(&abi).unwrap())?;
Ok(())
}
5 changes: 1 addition & 4 deletions examples/contract/sum-2/.liquid/abi_gen/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ fn main() -> Result<(), std::io::Error> {

let target_dir = env::var("CARGO_TARGET_DIR").unwrap_or("target".into());
std::fs::create_dir(&target_dir).ok();
std::fs::write(
format!("{}/sum-2.abi", target_dir),
serde_json::to_string(&abi).unwrap(),
)?;
std::fs::write("sum-2.abi", serde_json::to_string(&abi).unwrap())?;
Ok(())
}
9 changes: 9 additions & 0 deletions primitives/src/types/fixed_size_bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ seq!(N in 1..=32 {
#[cfg(test)]
mod tests {
use super::*;
use scale::Encode;

#[test]
fn bytes1_from_str() {
Expand All @@ -264,6 +265,14 @@ mod tests {
assert_eq!(b3[0], 0);
}

#[test]
fn bytes1_scale() {
let b1: Bytes1 = "1".parse().unwrap();
b1.using_encoded(|ref slice| {
assert_eq!(slice, &b"1");
});
}

#[test]
#[should_panic]
fn bytes1_from_str_panic() {
Expand Down

0 comments on commit 43afa18

Please sign in to comment.