diff --git a/src/components/presets/account_preset.cairo b/src/components/presets/account_preset.cairo index 7a87a86..765d282 100644 --- a/src/components/presets/account_preset.cairo +++ b/src/components/presets/account_preset.cairo @@ -7,13 +7,16 @@ pub mod AccountPreset { use token_bound_accounts::components::account::account::AccountComponent; use token_bound_accounts::components::upgradeable::upgradeable::UpgradeableComponent; use token_bound_accounts::components::lockable::lockable::LockableComponent; + use token_bound_accounts::components::permissionable::permissionable::PermissionableComponent; use token_bound_accounts::interfaces::{ - IUpgradeable::IUpgradeable, IExecutable::IExecutable, ILockable::ILockable + IUpgradeable::IUpgradeable, IExecutable::IExecutable, ILockable::ILockable, + IPermissionable::IPermissionable }; component!(path: AccountComponent, storage: account, event: AccountEvent); component!(path: UpgradeableComponent, storage: upgradeable, event: UpgradeableEvent); component!(path: LockableComponent, storage: lockable, event: LockableEvent); + component!(path: PermissionableComponent, storage: permissionable, event: PermissionableEvent); // Account #[abi(embed_v0)] @@ -22,6 +25,7 @@ pub mod AccountPreset { impl AccountInternalImpl = AccountComponent::InternalImpl; impl UpgradeableInternalImpl = UpgradeableComponent::Private; impl LockableImpl = LockableComponent::LockableImpl; + impl PermissionableImpl = PermissionableComponent::PermissionableImpl; // ************************************************************************* // STORAGE @@ -34,6 +38,8 @@ pub mod AccountPreset { upgradeable: UpgradeableComponent::Storage, #[substorage(v0)] lockable: LockableComponent::Storage, + #[substorage(v0)] + permissionable: PermissionableComponent::Storage, } // ************************************************************************* @@ -47,7 +53,9 @@ pub mod AccountPreset { #[flat] UpgradeableEvent: UpgradeableComponent::Event, #[flat] - LockableEvent: LockableComponent::Event + LockableEvent: LockableComponent::Event, + #[flat] + PermissionableEvent: PermissionableComponent::Event } // ************************************************************************* @@ -96,4 +104,19 @@ pub mod AccountPreset { self.lockable.is_locked() } } + + // ************************************************************************* + // PERMISSIONABLE IMPL + // ************************************************************************* + #[abi(embed_v0)] + impl Permissionable of IPermissionable { + fn set_permission(ref self: ContractState, permission_addresses: Array, + permissions: Array) { + self.permissionable.set_permission( permission_addresses, + permissions) + } + fn has_permission(self: @ContractState, permission_addresses: ContractAddress) -> bool { + self.permissionable.has_permission(permission_addresses) + } + } }