File tree Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Original file line number Diff line number Diff line change 1+ use hedera_proto:: services;
2+
3+ use crate :: {
4+ FromProtobuf ,
5+ ToProtobuf ,
6+ } ;
7+
8+ /// A slot in the storage of a lambda EVM hook.
9+ #[ derive( Debug , Clone , PartialEq , Eq ) ]
10+ pub struct LambdaStorageSlot {
11+ /// The key of the slot.
12+ pub key : Vec < u8 > ,
13+
14+ /// The value of the slot.
15+ pub value : Vec < u8 > ,
16+ }
17+
18+ impl LambdaStorageSlot {
19+ /// Create a new `LambdaStorageSlot`.
20+ pub fn new ( key : Vec < u8 > , value : Vec < u8 > ) -> Self {
21+ Self { key, value }
22+ }
23+
24+ /// Get the key.
25+ pub fn get_key ( & self ) -> & [ u8 ] {
26+ & self . key
27+ }
28+
29+ /// Get the value.
30+ pub fn get_value ( & self ) -> & [ u8 ] {
31+ & self . value
32+ }
33+
34+ /// Set the value.
35+ pub fn set_value ( & mut self , value : Vec < u8 > ) {
36+ self . value = value;
37+ }
38+
39+ /// Set the key.
40+ pub fn set_key ( & mut self , key : Vec < u8 > ) {
41+ self . key = key;
42+ }
43+ }
44+
45+ impl ToProtobuf for LambdaStorageSlot {
46+ type Protobuf = services:: LambdaStorageSlot ;
47+
48+ fn to_protobuf ( & self ) -> Self :: Protobuf {
49+ services:: LambdaStorageSlot { key : self . key . clone ( ) , value : self . value . clone ( ) }
50+ }
51+ }
52+
53+ impl FromProtobuf < services:: LambdaStorageSlot > for LambdaStorageSlot {
54+ fn from_protobuf ( pb : services:: LambdaStorageSlot ) -> crate :: Result < Self > {
55+ Ok ( Self { key : pb. key , value : pb. value } )
56+ }
57+ }
You can’t perform that action at this time.
0 commit comments