Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::constants::GENERATOR_INDEX__CONTRACT_LEAF;
use crate::traits::{Deserialize, FromField, Serialize, ToField};
use crate::traits::{Deserialize, FromField, Packable, Serialize, ToField};

pub struct ContractClassId {
pub inner: Field,
Expand Down Expand Up @@ -35,6 +35,17 @@ impl Deserialize<1> for ContractClassId {
}
}

// Implement the Packable trait so ContractClassId can be stored in contract's storage.
impl Packable<1> for ContractClassId {
fn pack(self) -> [Field; 1] {
self.serialize()
}

fn unpack(fields: [Field; 1]) -> Self {
Self::deserialize(fields)
}
}

impl ContractClassId {
pub fn compute(
artifact_hash: Field,
Expand Down
Loading