Skip to content

Commit

Permalink
Merge pull request #42 from ermvrs/main
Browse files Browse the repository at this point in the history
Accounts now use fallback address updates
  • Loading branch information
ermvrs authored Jan 10, 2025
2 parents 2ff1223 + 807daf7 commit 355af59
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ Rosetta Contracts is a smart contract library written in Cairo. It allows users
## Accounts
Starknet account abstraction smart contracts execute and validate transactions with Ethereum call data and signature. This account allows users to interact with Starknet with their Layer 1 accounts.

## Verifier
Utility smart contracts that format Ethereum call data according to ABI passed. It also validates Ethereum signature and call data formatting. Account contracts use this utility before executing the transactions.

## Lens
The Lens is a permissionless smart contract that registers and maps Ethereum addresses to the Starknet address equivalent and vice versa. Everyone can register any address to Lens. Only Account factory has a right to match any address with any address it passes. This ability is needed to match newly deployed account contracts with Layer 1 addresses.

Sepolia Deployment : 0x055f17a002c440e850c7005180ae803c7d2752f554add2ef7f3a740a24fadfa6 (Lens Dev)
## Contract Addresses
### Sepolia
Account Class: 0x0437eb056018e5c878f4231478a4e1370a82d3e2b1a163c9d1346e85fde87246
Rosettanet Class: 0x00c050554bb686f9c5e6a9557a372fcc0d6e9a9cc15b3d080bd37b15ff67af17
Rosettanet: 0x07c519e568e76ee8a72327ab30363059a6757fdd113f7b23db685ecf9b20a539
6 changes: 3 additions & 3 deletions src/accounts/base.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub mod RosettaAccount {
self.register_account(); // Register this contract if not registered on registry

let eth_target: EthAddress = call.to;
let sn_target: ContractAddress = IRosettanetDispatcher { contract_address: self.registry.read() }.get_starknet_address(eth_target);
let sn_target: ContractAddress = IRosettanetDispatcher { contract_address: self.registry.read() }.get_starknet_address_with_fallback(eth_target);
assert(sn_target != starknet::contract_address_const::<0>(), 'target not registered');

// Multicall or upgrade call
Expand Down Expand Up @@ -261,7 +261,7 @@ pub mod RosettaAccount {
let current_directive: u8 = *directives.at(index);
if(current_directive == 2_u8) {
let eth_address: EthAddress = (*calldata.at(index)).try_into().unwrap();
let sn_address = IRosettanetDispatcher{contract_address: self.registry.read()}.get_starknet_address(eth_address);
let sn_address = IRosettanetDispatcher{contract_address: self.registry.read()}.get_starknet_address_with_fallback(eth_address);
assert(sn_address != starknet::contract_address_const::<0>(), 'calldata address not registered');
updated_array.append(sn_address.into());
} else {
Expand All @@ -276,7 +276,7 @@ pub mod RosettaAccount {
// Sends native currency to the receiver address
fn process_native_transfer(self: @ContractState, value: u256, receiver: EthAddress) -> Span<felt252> {
assert(value > 0, 'value zero');
let sn_address = IRosettanetDispatcher{contract_address: self.registry.read()}.get_starknet_address(receiver);
let sn_address = IRosettanetDispatcher{contract_address: self.registry.read()}.get_starknet_address_with_fallback(receiver);
assert(sn_address != starknet::contract_address_const::<0>(), 'receiver not registered');

let calldata: Span<felt252> = array![sn_address.into(), value.low.into(), value.high.into()].span();
Expand Down

0 comments on commit 355af59

Please sign in to comment.