Skip to content

Commit

Permalink
chore: scarb fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Darlington02 committed Aug 15, 2024
1 parent 3e60a18 commit 0923398
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 21 deletions.
18 changes: 12 additions & 6 deletions src/account/account.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ mod AccountComponent {
TContractState, +HasComponent<TContractState>, +Drop<TContractState>
> of IAccount<ComponentState<TContractState>> {
/// @notice used for signature validation
/// @param hash The message hash
/// @param hash The message hash
/// @param signature The signature to be validated
fn is_valid_signature(
self: @ComponentState<TContractState>, hash: felt252, signature: Span<felt252>
Expand All @@ -92,7 +92,9 @@ mod AccountComponent {
}

fn __validate_deploy__(
ref self: ComponentState<TContractState>, token_contract: ContractAddress, token_id: u256
ref self: ComponentState<TContractState>,
token_contract: ContractAddress,
token_id: u256
) -> felt252 {
self._validate_transaction()
}
Expand Down Expand Up @@ -146,8 +148,8 @@ mod AccountComponent {
self._get_token()
}

// @notice protection mechanism for selling token bound accounts. can't execute when account is locked
// @param duration for which to lock account
// @notice protection mechanism for selling token bound accounts. can't execute when account
// is locked @param duration for which to lock account
fn lock(ref self: ComponentState<TContractState>, duration: u64) {
let caller = get_caller_address();
assert(self._is_valid_signer(caller), Errors::UNAUTHORIZED);
Expand Down Expand Up @@ -205,7 +207,10 @@ mod AccountComponent {
/// @notice internal function for getting NFT owner
/// @param token_contract contract address of NFT
// @param token_id token ID of NFT
// NB: This function aims for compatibility with all contracts (snake or camel case) but do not work as expected on mainnet as low level calls do not return err at the moment. Should work for contracts which implements CamelCase but not snake_case until starknet v0.15.
// NB: This function aims for compatibility with all contracts (snake or camel case) but do
// not work as expected on mainnet as low level calls do not return err at the moment.
// Should work for contracts which implements CamelCase but not snake_case until starknet
// v0.15.
fn _get_owner(
self: @ComponentState<TContractState>, token_contract: ContractAddress, token_id: u256
) -> ContractAddress {
Expand All @@ -228,7 +233,8 @@ mod AccountComponent {
(contract, tokenId)
}

// @notice protection mechanism for TBA trading. Returns the lock-status (true or false), and the remaning time till account unlocks.
// @notice protection mechanism for TBA trading. Returns the lock-status (true or false),
// and the remaning time till account unlocks.
fn _is_locked(self: @ComponentState<TContractState>) -> (bool, u64) {
let unlock_timestamp = self.account_unlock_timestamp.read();
let current_time = get_block_timestamp();
Expand Down
2 changes: 1 addition & 1 deletion src/components.cairo
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
mod lockable;
mod permissionable;
mod upgradeable;
mod upgradeable;
2 changes: 1 addition & 1 deletion src/components/lockable.cairo
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mod lockable;
mod lockable;
4 changes: 3 additions & 1 deletion src/components/lockable/lockable.cairo
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
// lockable component
// lockable component


2 changes: 1 addition & 1 deletion src/components/permissionable.cairo
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mod permissionable;
mod permissionable;
4 changes: 3 additions & 1 deletion src/components/permissionable/permissionable.cairo
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
// permissionable component
// permissionable component


4 changes: 3 additions & 1 deletion src/interfaces/IAccount.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ trait IAccount<TContractState> {
fn is_valid_signer(self: @TContractState, signer: ContractAddress) -> felt252;
fn __validate__(ref self: TContractState, calls: Array<Call>) -> felt252;
fn __validate_declare__(self: @TContractState, class_hash: felt252) -> felt252;
fn __validate_deploy__(ref self: TContractState, token_contract: ContractAddress, token_id: u256) -> felt252;
fn __validate_deploy__(
ref self: TContractState, token_contract: ContractAddress, token_id: u256
) -> felt252;
fn __execute__(ref self: TContractState, calls: Array<Call>) -> Array<Span<felt252>>;
fn token(self: @TContractState) -> (ContractAddress, u256);
fn owner(self: @TContractState) -> ContractAddress;
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IRegistry.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trait IRegistry<TContractState> {
salt: felt252,
chain_id: felt252
) -> ContractAddress;

fn get_account(
self: @TContractState,
implementation_hash: felt252,
Expand Down
15 changes: 7 additions & 8 deletions src/registry/registry.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,11 @@ mod Registry {
use core::hash::HashStateTrait;
use core::pedersen::PedersenTrait;
use starknet::{
ContractAddress,
get_caller_address,
syscalls::{call_contract_syscall, deploy_syscall},
class_hash::{ClassHash, Felt252TryIntoClassHash},
SyscallResultTrait,
storage::Map
ContractAddress, get_caller_address, syscalls::{call_contract_syscall, deploy_syscall},
class_hash::{ClassHash, Felt252TryIntoClassHash}, SyscallResultTrait, storage::Map
};

use token_bound_accounts::interfaces::IERC721::{ IERC721DispatcherTrait, IERC721Dispatcher };
use token_bound_accounts::interfaces::IERC721::{IERC721DispatcherTrait, IERC721Dispatcher};
use token_bound_accounts::interfaces::IRegistry::IRegistry;

// *************************************************************************
Expand Down Expand Up @@ -126,7 +122,10 @@ mod Registry {
/// @notice internal function for getting NFT owner
/// @param token_contract contract address of NFT
// @param token_id token ID of NFT
// NB: This function aims for compatibility with all contracts (snake or camel case) but do not work as expected on mainnet as low level calls do not return err at the moment. Should work for contracts which implements CamelCase but not snake_case until starknet v0.15.
// NB: This function aims for compatibility with all contracts (snake or camel case) but do
// not work as expected on mainnet as low level calls do not return err at the moment.
// Should work for contracts which implements CamelCase but not snake_case until starknet
// v0.15.
fn _get_owner(
self: @ContractState, token_contract: ContractAddress, token_id: u256
) -> ContractAddress {
Expand Down

0 comments on commit 0923398

Please sign in to comment.