use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SmartAccountAction {
pub target: String,
pub value: String,
pub call_data: Vec<u8>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ERC7579Execution {
pub execution_mode: [u8; 32],
pub actions: Vec<SmartAccountAction>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ModuleType {
Validator = 1,
Executor = 2,
Fallback = 3,
Hook = 4,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ModuleConfig {
pub module_type: ModuleType,
pub module_address: String,
pub init_data: Vec<u8>,
}
pub struct ModularAccountManager {
}
impl Default for ModularAccountManager {
fn default() -> Self {
Self::new()
}
}
impl ModularAccountManager {
pub fn new() -> Self {
Self {}
}
pub fn prepare_execution(&self, actions: Vec<SmartAccountAction>) -> ERC7579Execution {
let mut execution_mode = [0u8; 32];
execution_mode[0] = 0x01;
ERC7579Execution {
execution_mode,
actions,
}
}
pub fn validate_module_setup(&self, config: &ModuleConfig) -> bool {
!config.module_address.is_empty()
}
}