Skip to content

Commit 788f80d

Browse files
committed
better params and return types
1 parent 56df558 commit 788f80d

File tree

10 files changed

+653
-417
lines changed

10 files changed

+653
-417
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ Cargo.lock
88

99
# These are backup files generated by rustfmt
1010
**/*.rs.bk
11+
12+
.vscode

fil_token/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ fvm_ipld_amt = { version = "0.4.2", features = ["go-interop"] }
1313
fvm_ipld_encoding = "0.2.2"
1414
fvm_sdk = { version = "1.0.0" }
1515
fvm_shared = { version = "0.8.0" }
16-
serde = { version = "1.0.136", features = ["derive"] }
16+
serde = { version = "1.0.136", features = ["derive"] }
17+
serde_tuple = { version = "0.5.0" }

fil_token/src/blockstore.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ impl fvm_ipld_blockstore::Blockstore for Blockstore {
2626
}
2727
Ok(())
2828
}
29+
2930
fn put<D>(&self, code: Code, block: &Block<D>) -> Result<Cid>
3031
where
3132
D: AsRef<[u8]>,

fil_token/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
pub mod blockstore;
2+
pub mod runtime;
23
pub mod token;
34

45
#[cfg(test)]

fil_token/src/runtime/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub trait Runtime {}

fil_token/src/token/errors.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
use super::state::StateError;
2+
use fvm_ipld_hamt::Error as HamtError;
3+
use fvm_shared::address::Address;
4+
5+
pub enum ActorError {
6+
AddrNotFound(Address),
7+
IpldState(StateError),
8+
IpldHamt(HamtError),
9+
Arithmetic(String),
10+
}
11+
12+
impl From<StateError> for ActorError {
13+
fn from(e: StateError) -> Self {
14+
Self::IpldState(e)
15+
}
16+
}
17+
18+
impl From<HamtError> for ActorError {
19+
fn from(e: HamtError) -> Self {
20+
Self::IpldHamt(e)
21+
}
22+
}

0 commit comments

Comments
 (0)