Skip to content

Commit

Permalink
add check for caller address
Browse files Browse the repository at this point in the history
  • Loading branch information
mubarak23 committed Sep 2, 2024
1 parent 445f57c commit 5ab435a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/components/permissionable/permissionable.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ pub mod PermissionableComponent {
// *************************************************************************
pub mod Errors {
pub const INVALID_LENGTH: felt252 = 'Account: invalid length';
pub const UNAUTHORIZED: felt252 = 'Account: unauthorized';
}


Expand All @@ -76,6 +77,8 @@ pub mod PermissionableComponent {

let account_comp = get_dep_component!(@self, Account);
let owner = account_comp.owner();
assert(owner == get_caller_address(), Errors::UNAUTHORIZED);

let length = permissioned_addresses.len();
let mut index: u32 = 0;
while index < length {
Expand Down
4 changes: 0 additions & 4 deletions src/components/presets/account_preset.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,6 @@ pub mod AccountPreset {
permissioned_addresses: Array<ContractAddress>,
permissions: Array<bool>
) {
// validate signer
let caller = get_caller_address();
assert(self.is_valid_signer(caller), 'Account: unauthorized');

// set permissions
self.permissionable.set_permission(permissioned_addresses, permissions)
}
Expand Down

0 comments on commit 5ab435a

Please sign in to comment.