use miden_protocol::account::AccountComponent;
use miden_protocol::account::component::{AccountComponentCode, AccountComponentMetadata};
use crate::account::account_component_code;
account_component_code!(
BLOCKLIST_OWNER_CONTROLLED_CODE,
"faucets/policies/transfer/blocklist/owner_controlled.masl"
);
#[derive(Debug, Clone, Copy, Default)]
pub struct BlocklistOwnerControlled;
impl BlocklistOwnerControlled {
pub const NAME: &'static str =
"miden::standards::components::faucets::policies::transfer::blocklist::owner_controlled";
pub fn code() -> &'static AccountComponentCode {
&BLOCKLIST_OWNER_CONTROLLED_CODE
}
pub fn component_metadata() -> AccountComponentMetadata {
AccountComponentMetadata::new(Self::NAME).with_description(
"Owner-controlled blocklist admin: wraps `blocklist::block_account` / \
`unblock_account` with Ownable2Step authorization.",
)
}
}
impl From<BlocklistOwnerControlled> for AccountComponent {
fn from(_: BlocklistOwnerControlled) -> Self {
let metadata = BlocklistOwnerControlled::component_metadata();
AccountComponent::new(BlocklistOwnerControlled::code().clone(), vec![], metadata)
.expect("owner-controlled blocklist admin component should be valid")
}
}