Skip to content

Commit 50bec1a

Browse files
committed
Support add debugger
1 parent c176286 commit 50bec1a

File tree

10 files changed

+1478
-0
lines changed

10 files changed

+1478
-0
lines changed

add-debugger/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/build
2+
/target

add-debugger/Cargo.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[package]
2+
name = "{{project-name}}"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
[dependencies]
8+
{{contract_name}} = { path = "../", features = ["simulator"] }
9+
ckb-std = { version = "0.15.1", features = ["simulator"] }
10+
11+
[lib]
12+
crate-type = ["cdylib"]
13+
14+
[workspace]

add-debugger/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# {{project-name}}
2+
3+
TODO: Write this readme
4+
5+
*This contract was bootstrapped with [ckb-script-templates].*
6+
7+
[ckb-script-templates]: https://github.com/cryptape/ckb-script-templates

add-debugger/cargo-generate.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[template]
2+
cargo_generate_version = ">=0.16.0"
3+
4+
[placeholders]
5+
contract_name = { prompt = "contract name", type = "string" }
6+
contract_crate_name = { prompt = "contract crate name", type = "string" }

add-debugger/src/contract-lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#![cfg_attr(not(feature = "simulator"), no_std)]
2+
3+
// This file will be automatically placed in the contract file, and rename to lib.rs
4+
// TODO
5+
// Need to export main function.
6+
// At the same time, you need to add a feature to the contract's Cargo.toml.
7+
// simulator = ["ckb-std/simulator"]
8+
9+
// #[cfg(feature = "simulator")]
10+
// pub mod entry;

add-debugger/src/lib.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
ckb_std::entry_simulator!(program_entry);
2+
ckb_std::default_alloc!();
3+
4+
/// program entry
5+
fn program_entry() -> i8 {
6+
// Call main function and return error code
7+
// match {{contract_crate_name}}::entry::main() {
8+
// Ok(_) => 0,
9+
// Err(err) => err as i8,
10+
// }
11+
0
12+
}

cargo-generate.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ sub_templates = [
77
"contract",
88
"atomics-contract",
99
"stack-reorder-contract",
10+
"add-debugger-contract"
1011
# Dependency crate templates
1112
"c-wrapper-crate",
1213
"x64-simulator-crate",

0 commit comments

Comments
 (0)