Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lib target #129

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
eac8ec2
Add lib target
tarrencev Jul 17, 2024
667fb66
make cross origin optional
piniom Aug 6, 2024
1bf3539
fix empty cross origin pseudo parsing
piniom Aug 6, 2024
b3432d5
Merge pull request #1 from cartridge-gg/cross-origin
tarrencev Aug 6, 2024
7188f8d
Support topOrigin in webauthn verification
tarrencev Aug 15, 2024
f6796ba
make top origin option
broody Aug 15, 2024
7c36617
Merge pull request #3 from cartridge-gg/toporigin
broody Aug 15, 2024
7ea55a0
compiles
piniom Aug 21, 2024
cb64110
switched to built-in sha256
piniom Aug 21, 2024
cca66d4
removed validate_deploy warning
piniom Aug 21, 2024
b4f358e
moved to warning-free fork of alexandria
piniom Aug 21, 2024
def4c2e
removed sha256 cairo version
piniom Aug 21, 2024
b6b18b2
Merge pull request #2 from cartridge-gg/cairo-2.7
piniom Aug 26, 2024
c6c1389
fixed webauthn signature serialization problem with cross origin and …
piniom Aug 26, 2024
daa8200
Merge pull request #4 from cartridge-gg/webauthn-ser
piniom Aug 26, 2024
41ce703
Support nonce channels for outside execution
tarrencev Oct 10, 2024
f3df11d
Merge pull request #5 from cartridge-gg/noncechannels
tarrencev Oct 14, 2024
3c5d1a2
Add channel nonce getter
tarrencev Oct 14, 2024
66e827e
Merge pull request #6 from cartridge-gg/getnoncechannel
tarrencev Oct 14, 2024
1432f85
Remove whitepsace from type hash
tarrencev Oct 14, 2024
30abbb7
Add configurable guardian to sessions
tarrencev Oct 17, 2024
3f3173e
Merge pull request #7 from cartridge-gg/guardiansession
tarrencev Oct 17, 2024
f81d678
created structs for typed data
piniom Oct 18, 2024
a95a528
Update precomputed execute from outside hashes
tarrencev Oct 18, 2024
946530f
Merge pull request #8 from cartridge-gg/session-off-chain-sig
tarrencev Oct 18, 2024
db2927f
Add nonce mask
tarrencev Oct 18, 2024
9007a82
Merge pull request #9 from cartridge-gg/noncemask
tarrencev Oct 23, 2024
9ae0152
feat: rename `type_hash` to `scope_hash`
xJonathanLEI Nov 21, 2024
22a3b83
Merge pull request #10 from cartridge-gg/dev/fix_typed_data
tarrencev Nov 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
scarb 2.6.3
scarb 2.7.0
starknet-foundry 0.20.0
119 changes: 110 additions & 9 deletions Scarb.lock
Original file line number Diff line number Diff line change
@@ -1,48 +1,68 @@
# Code generated by scarb DO NOT EDIT.
version = 1

[[package]]
name = "alexandria_bytes"
version = "0.1.0"
source = "git+https://github.com/piniom/quaireaux.git?rev=b51ccc3#b51ccc3045b87d521ce4ec0ff28775c3a94468c4"
dependencies = [
"alexandria_data_structures",
"alexandria_math",
]

[[package]]
name = "alexandria_data_structures"
version = "0.2.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=cairo-v2.6.0#946e6e2f9d390ad9f345882a352c0dd6f02ef3ad"
source = "git+https://github.com/piniom/quaireaux.git?rev=b51ccc3#b51ccc3045b87d521ce4ec0ff28775c3a94468c4"
dependencies = [
"alexandria_encoding",
]

[[package]]
name = "alexandria_encoding"
version = "0.1.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=cairo-v2.6.0#946e6e2f9d390ad9f345882a352c0dd6f02ef3ad"
source = "git+https://github.com/piniom/quaireaux.git?rev=b51ccc3#b51ccc3045b87d521ce4ec0ff28775c3a94468c4"
dependencies = [
"alexandria_bytes",
"alexandria_math",
"alexandria_numeric",
]

[[package]]
name = "alexandria_math"
version = "0.2.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=cairo-v2.6.0#946e6e2f9d390ad9f345882a352c0dd6f02ef3ad"
source = "git+https://github.com/piniom/quaireaux.git?rev=b51ccc3#b51ccc3045b87d521ce4ec0ff28775c3a94468c4"
dependencies = [
"alexandria_data_structures",
]

[[package]]
name = "alexandria_merkle_tree"
version = "0.1.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git?tag=cairo-v2.6.0#946e6e2f9d390ad9f345882a352c0dd6f02ef3ad"
source = "git+https://github.com/piniom/quaireaux.git?rev=b51ccc3#b51ccc3045b87d521ce4ec0ff28775c3a94468c4"

[[package]]
name = "alexandria_numeric"
version = "0.1.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=cairo-v2.6.0#946e6e2f9d390ad9f345882a352c0dd6f02ef3ad"
source = "git+https://github.com/piniom/quaireaux.git?rev=b51ccc3#b51ccc3045b87d521ce4ec0ff28775c3a94468c4"
dependencies = [
"alexandria_math",
"alexandria_searching",
]

[[package]]
name = "alexandria_searching"
version = "0.1.0"
source = "git+https://github.com/piniom/quaireaux.git?rev=b51ccc3#b51ccc3045b87d521ce4ec0ff28775c3a94468c4"
dependencies = [
"alexandria_data_structures",
]

[[package]]
name = "argent"
version = "0.1.0"
dependencies = [
"alexandria_data_structures",
"alexandria_encoding",
"alexandria_math",
"alexandria_merkle_tree",
Expand All @@ -52,10 +72,91 @@ dependencies = [

[[package]]
name = "openzeppelin"
version = "0.12.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.12.0#0697004db74502ce49900edef37331dd03531356"
version = "0.15.0-rc.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?rev=a13bae3#a13bae3390a7114a8c14c0352c6898eff5f4f5d7"
dependencies = [
"openzeppelin_access",
"openzeppelin_account",
"openzeppelin_governance",
"openzeppelin_introspection",
"openzeppelin_presets",
"openzeppelin_security",
"openzeppelin_token",
"openzeppelin_upgrades",
"openzeppelin_utils",
]

[[package]]
name = "openzeppelin_access"
version = "0.15.0-rc.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?rev=a13bae3#a13bae3390a7114a8c14c0352c6898eff5f4f5d7"
dependencies = [
"openzeppelin_introspection",
"openzeppelin_utils",
]

[[package]]
name = "openzeppelin_account"
version = "0.15.0-rc.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?rev=a13bae3#a13bae3390a7114a8c14c0352c6898eff5f4f5d7"
dependencies = [
"openzeppelin_introspection",
"openzeppelin_token",
"openzeppelin_utils",
]

[[package]]
name = "openzeppelin_governance"
version = "0.15.0-rc.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?rev=a13bae3#a13bae3390a7114a8c14c0352c6898eff5f4f5d7"
dependencies = [
"openzeppelin_access",
"openzeppelin_introspection",
]

[[package]]
name = "openzeppelin_introspection"
version = "0.15.0-rc.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?rev=a13bae3#a13bae3390a7114a8c14c0352c6898eff5f4f5d7"

[[package]]
name = "openzeppelin_presets"
version = "0.15.0-rc.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?rev=a13bae3#a13bae3390a7114a8c14c0352c6898eff5f4f5d7"
dependencies = [
"openzeppelin_access",
"openzeppelin_account",
"openzeppelin_introspection",
"openzeppelin_token",
"openzeppelin_upgrades",
]

[[package]]
name = "openzeppelin_security"
version = "0.15.0-rc.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?rev=a13bae3#a13bae3390a7114a8c14c0352c6898eff5f4f5d7"

[[package]]
name = "openzeppelin_token"
version = "0.15.0-rc.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?rev=a13bae3#a13bae3390a7114a8c14c0352c6898eff5f4f5d7"
dependencies = [
"openzeppelin_account",
"openzeppelin_governance",
"openzeppelin_introspection",
]

[[package]]
name = "openzeppelin_upgrades"
version = "0.15.0-rc.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?rev=a13bae3#a13bae3390a7114a8c14c0352c6898eff5f4f5d7"

[[package]]
name = "openzeppelin_utils"
version = "0.15.0-rc.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?rev=a13bae3#a13bae3390a7114a8c14c0352c6898eff5f4f5d7"

[[package]]
name = "snforge_std"
version = "0.20.0"
source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.20.0#423eecf7847469e353258321274394b9155d24eb"
version = "0.27.0"
source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.27.0#2d99b7c00678ef0363881ee0273550c44a9263de"
15 changes: 9 additions & 6 deletions Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@ name = "argent"
version = "0.1.0"
cairo-version = "2.6.3"

[[target.lib]]

[[target.starknet-contract]]
sierra = true
casm = true
allowed-libfuncs-list.name = "audited"
build-external-contracts = ["openzeppelin::presets::account::AccountUpgradeable"]

[dependencies]
starknet = "2.6.3"
alexandria_math = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "cairo-v2.6.0" }
alexandria_encoding = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "cairo-v2.6.0" }
alexandria_merkle_tree = { git = "https://github.com/keep-starknet-strange/alexandria.git", tag="cairo-v2.6.0" }
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.20.0" }
openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.12.0" }
starknet = "2.7.0"
alexandria_math = { git = "https://github.com/piniom/quaireaux.git", rev = "b51ccc3" }
alexandria_encoding = { git = "https://github.com/piniom/quaireaux.git", rev = "b51ccc3" }
alexandria_merkle_tree = { git = "https://github.com/piniom/quaireaux.git", rev = "b51ccc3" }
alexandria_data_structures = { git = "https://github.com/piniom/quaireaux.git", rev = "b51ccc3" }
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.27.0" }
openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", rev = "a13bae3" }

[tool.fmt]
max-line-length = 120
Expand Down
2 changes: 1 addition & 1 deletion src/account/interface.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ trait IArgentAccount<TContractState> {
self: @TContractState,
class_hash: felt252,
contract_address_salt: felt252,
threshold: usize,
new_threshold: usize,
signers: Array<Signer>
) -> felt252;
fn get_name(self: @TContractState) -> felt252;
Expand Down
2 changes: 1 addition & 1 deletion src/external_recovery/external_recovery.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ mod external_recovery_component {
use super::{IExternalRecoveryCallback, get_escape_call_hash};

/// Minimum time for the escape security period
const MIN_ESCAPE_PERIOD: u64 = consteval_int!(60 * 10); // 10 minutes;
const MIN_ESCAPE_PERIOD: u64 = 60 * 10; // 10 minutes;

#[storage]
struct Storage {
Expand Down
24 changes: 14 additions & 10 deletions src/introspection/src5.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ mod src5_component {
};
use argent::introspection::interface::{ISRC5, ISRC5Legacy};
use argent::introspection::interface::{SRC5_INTERFACE_ID, SRC5_INTERFACE_ID_OLD};
use argent::outside_execution::interface::{
ERC165_OUTSIDE_EXECUTION_INTERFACE_ID_REV_0, ERC165_OUTSIDE_EXECUTION_INTERFACE_ID_REV_1
};
use argent::outside_execution::interface::{ERC165_OUTSIDE_EXECUTION_INTERFACE_ID_REV_2};

#[storage]
struct Storage {}

#[embeddable_as(SRC5Impl)]
impl SRC5<TContractState, +HasComponent<TContractState>> of ISRC5<ComponentState<TContractState>> {
fn supports_interface(self: @ComponentState<TContractState>, interface_id: felt252) -> bool {
impl SRC5<
TContractState, +HasComponent<TContractState>
> of ISRC5<ComponentState<TContractState>> {
fn supports_interface(
self: @ComponentState<TContractState>, interface_id: felt252
) -> bool {
if interface_id == SRC5_INTERFACE_ID {
true
} else if interface_id == SRC5_ACCOUNT_INTERFACE_ID {
true
} else if interface_id == ERC165_OUTSIDE_EXECUTION_INTERFACE_ID_REV_0 {
true
} else if interface_id == ERC165_OUTSIDE_EXECUTION_INTERFACE_ID_REV_1 {
} else if interface_id == ERC165_OUTSIDE_EXECUTION_INTERFACE_ID_REV_2 {
true
} else if interface_id == SRC5_INTERFACE_ID_OLD {
true
Expand All @@ -36,8 +36,12 @@ mod src5_component {
}

#[embeddable_as(SRC5LegacyImpl)]
impl SRC5Legacy<TContractState, +HasComponent<TContractState>> of ISRC5Legacy<ComponentState<TContractState>> {
fn supportsInterface(self: @ComponentState<TContractState>, interfaceId: felt252) -> felt252 {
impl SRC5Legacy<
TContractState, +HasComponent<TContractState>
> of ISRC5Legacy<ComponentState<TContractState>> {
fn supportsInterface(
self: @ComponentState<TContractState>, interfaceId: felt252
) -> felt252 {
if self.supports_interface(interfaceId) {
1
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/mocks/future_argent_multisig.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ mod MockFutureArgentMultisig {
self: @ContractState,
class_hash: felt252,
contract_address_salt: felt252,
threshold: usize,
new_threshold: usize,
signers: Array<Signer>
) -> felt252 {
panic_with_felt252('argent/deploy-not-available')
Expand Down
5 changes: 3 additions & 2 deletions src/mocks/mock_dapp.cairo
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// @dev 🚨 This smart contract is a mock implementation and is not meant for actual deployment or use in any live environment. It is solely for testing, educational, or demonstration purposes. Any interactions with this contract will not have real-world consequences or effects on blockchain networks. Please refrain from relying on the functionality of this contract for any production. 🚨
use starknet::ContractAddress;
use starknet::storage::Map;

#[starknet::interface]
trait IMockDapp<TContractState> {
Expand All @@ -14,11 +15,11 @@ trait IMockDapp<TContractState> {

#[starknet::contract]
mod MockDapp {
use starknet::{get_caller_address, ContractAddress};
use starknet::{get_caller_address, ContractAddress, storage::Map};

#[storage]
struct Storage {
stored_number: LegacyMap<ContractAddress, felt252>,
stored_number: Map<ContractAddress, felt252>,
}

#[abi(embed_v0)]
Expand Down
6 changes: 3 additions & 3 deletions src/mocks/mock_erc20.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ trait IErc20Mock<TContractState> {

#[starknet::contract]
mod Erc20Mock {
use starknet::{info::{get_caller_address}, ContractAddress};
use starknet::{info::{get_caller_address}, ContractAddress, storage::Map};

#[storage]
struct Storage {
balances: LegacyMap<ContractAddress, u256>,
allowances: LegacyMap<(ContractAddress, ContractAddress), u256>,
balances: Map<ContractAddress, u256>,
allowances: Map<(ContractAddress, ContractAddress), u256>,
}

#[abi(embed_v0)]
Expand Down
Loading