Skip to content

Commit

Permalink
Implement cast fn for Origin trait
Browse files Browse the repository at this point in the history
  • Loading branch information
breathx committed Dec 4, 2023
1 parent 162cec1 commit 450854f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ pub type Gas = u64;
pub trait Origin: Sized {
fn into_origin(self) -> H256;
fn from_origin(val: H256) -> Self;
fn cast<T: Origin>(self) -> T {
T::from_origin(self.into_origin())
}
}

impl Origin for u64 {
Expand Down

0 comments on commit 450854f

Please sign in to comment.