Skip to content

Commit 56df558

Browse files
committed
author an actor that uses fil_token
1 parent b14b584 commit 56df558

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

fil_token/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ name = "fil_token"
33
version = "0.1.0"
44
edition = "2021"
55

6-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7-
86
[dependencies]
97
anyhow = "1.0.56"
108
cid = { version = "0.8.3", default-features = false, features = ["serde-codec"] }

rust-toolchain

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nightly

testing/integration/actors/fil_token_actor/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ edition = "2021"
77
[dependencies]
88
fvm_sdk = { version = "1.0.0 "}
99
fvm_shared = { version = "0.8.0" }
10+
fil_token = { version = "0.1.0", path = "../../../../fil_token" }
1011

1112
[build-dependencies]
1213
wasm-builder = "3.0.1"
Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
1+
use fil_token;
12
use fvm_sdk as sdk;
23

34
/// Placeholder invoke for testing
45
#[no_mangle]
5-
pub fn invoke(_: u32) -> u32 {
6+
pub fn invoke(params: u32) -> u32 {
67
// Conduct method dispatch. Handle input parameters and return data.
7-
sdk::vm::abort(
8-
fvm_shared::error::ExitCode::FIRST_USER_EXIT_CODE,
9-
Some("sample abort"),
10-
)
8+
let method_num = sdk::message::method_number();
9+
10+
match method_num {
11+
1 => constructor(),
12+
_ => {
13+
sdk::vm::abort(
14+
fvm_shared::error::ExitCode::FIRST_USER_EXIT_CODE,
15+
Some("sample abort"),
16+
);
17+
}
18+
}
19+
}
20+
21+
fn constructor() -> u32 {
22+
0_u32
1123
}

0 commit comments

Comments
 (0)