Skip to content

Commit

Permalink
chore: upgrade contracts to v2.8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Darlington02 committed Sep 30, 2024
1 parent 25756e9 commit 9972361
Show file tree
Hide file tree
Showing 22 changed files with 158 additions and 213 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ jobs:
- uses: software-mansion/setup-scarb@v1
- uses: foundry-rs/setup-snfoundry@v3
with:
starknet-foundry-version: 0.27.0
starknet-foundry-version: 0.31.0
- name: Run cairo tests
run: snforge test
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# ERC-6551 Reference Implementation on Starknet (SNIP-14)
# ERC-6551 Implementation on Starknet (SNIP-14)

This repository contains the reference implementation of ERC-6551 on Starknet.

**NB:** This project is under active development and may undergo changes until SNIP-14 is finalized.
**NB:** This project is under active development and may undergo changes until [SNIP-14](https://github.com/starknet-io/SNIPs/blob/main/SNIPS/snip-14.md) is finalized.

## The Tokenbound Standard
This proposal defines a system which assigns contract accounts to Non-fungible tokens (ERC-721s).
Expand Down
69 changes: 47 additions & 22 deletions Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ version = 1

[[package]]
name = "openzeppelin"
version = "0.15.1"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"
dependencies = [
"openzeppelin_access",
"openzeppelin_account",
"openzeppelin_finance",
"openzeppelin_governance",
"openzeppelin_introspection",
"openzeppelin_merkle_tree",
"openzeppelin_presets",
"openzeppelin_security",
"openzeppelin_token",
Expand All @@ -19,57 +21,72 @@ dependencies = [

[[package]]
name = "openzeppelin_access"
version = "0.15.1"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"
dependencies = [
"openzeppelin_introspection",
"openzeppelin_utils",
]

[[package]]
name = "openzeppelin_account"
version = "0.15.1"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"
dependencies = [
"openzeppelin_introspection",
"openzeppelin_utils",
]

[[package]]
name = "openzeppelin_finance"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"
dependencies = [
"openzeppelin_access",
"openzeppelin_token",
]

[[package]]
name = "openzeppelin_governance"
version = "0.15.1"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"
dependencies = [
"openzeppelin_access",
"openzeppelin_introspection",
]

[[package]]
name = "openzeppelin_introspection"
version = "0.15.1"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"

[[package]]
name = "openzeppelin_merkle_tree"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"

[[package]]
name = "openzeppelin_presets"
version = "0.15.1"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"
dependencies = [
"openzeppelin_access",
"openzeppelin_account",
"openzeppelin_finance",
"openzeppelin_introspection",
"openzeppelin_token",
"openzeppelin_upgrades",
]

[[package]]
name = "openzeppelin_security"
version = "0.15.1"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"

[[package]]
name = "openzeppelin_token"
version = "0.15.1"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"
dependencies = [
"openzeppelin_account",
"openzeppelin_governance",
Expand All @@ -78,18 +95,26 @@ dependencies = [

[[package]]
name = "openzeppelin_upgrades"
version = "0.15.1"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"

[[package]]
name = "openzeppelin_utils"
version = "0.15.1"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"

[[package]]
name = "snforge_scarb_plugin"
version = "0.31.0"
source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.31.0#72ea785ca354e9e506de3e5d687da9fb2c1b3c67"

[[package]]
name = "snforge_std"
version = "0.27.0"
source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.27.0#2d99b7c00678ef0363881ee0273550c44a9263de"
version = "0.31.0"
source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.31.0#72ea785ca354e9e506de3e5d687da9fb2c1b3c67"
dependencies = [
"snforge_scarb_plugin",
]

[[package]]
name = "token_bound_accounts"
Expand Down
8 changes: 4 additions & 4 deletions Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repository = "https://github.com/horuslabsio/TBA/blob/main/Scarb.toml"
license-file = "LICENSE"
keywords = ["ERC6551", "tokenbound", "cairo", "contracts", "starknet", "standards"]
readme = "README.md"
cairo_version = "2.7.0"
cairo_version = "2.8.2"
homepage = "https://www.tbaexplorer.com/"
documentation = "https://github.com/horuslabsio/TBA-SDK"

Expand All @@ -22,11 +22,11 @@ casm = true
[lib]

[dependencies]
starknet = "2.7.0"
openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.15.1" }
starknet = "2.8.2"
openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.17.0" }

[dev-dependencies]
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.27.0" }
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.31.0" }

[tool.snforge]
# exit_first = true
2 changes: 0 additions & 2 deletions src/components/account.cairo
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
pub mod account;

use account::AccountComponent;
11 changes: 3 additions & 8 deletions src/components/account/account.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,10 @@ pub mod AccountComponent {
result::ResultTrait, hash::HashStateTrait, pedersen::PedersenTrait, num::traits::zero::Zero
};
use starknet::{
get_tx_info, get_caller_address, get_contract_address, get_block_timestamp, ContractAddress,
account::Call, syscalls::call_contract_syscall, syscalls::replace_class_syscall, ClassHash,
SyscallResultTrait, storage::StoragePointerWriteAccess
};

use token_bound_accounts::interfaces::IERC721::{IERC721DispatcherTrait, IERC721Dispatcher};
use token_bound_accounts::interfaces::IAccount::{
IAccount, IAccountDispatcherTrait, IAccountDispatcher, TBA_INTERFACE_ID
get_tx_info, get_contract_address, ContractAddress, account::Call,
syscalls::call_contract_syscall, storage::StoragePointerWriteAccess
};
use token_bound_accounts::interfaces::IAccount::{IAccount, TBA_INTERFACE_ID};

use openzeppelin::introspection::src5::SRC5Component;
use openzeppelin::introspection::src5::SRC5Component::{SRC5Impl, InternalImpl};
Expand Down
5 changes: 0 additions & 5 deletions src/components/lockable/lockable.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@ pub mod LockableComponent {
use starknet::{ContractAddress, get_caller_address, get_block_timestamp};

use token_bound_accounts::components::account::account::AccountComponent;
use token_bound_accounts::interfaces::IAccount::{IAccount, IAccountDispatcherTrait};
use token_bound_accounts::components::account::account::AccountComponent::AccountPrivateImpl;
use token_bound_accounts::interfaces::ILockable::{
ILockable, ILockableDispatcher, ILockableDispatcherTrait
};

use openzeppelin::introspection::src5::SRC5Component;

// *************************************************************************
Expand Down
8 changes: 2 additions & 6 deletions src/components/permissionable/permissionable.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@ pub mod PermissionableComponent {
// IMPORTS
// *************************************************************************
use starknet::storage::{Map, StorageMapReadAccess, StorageMapWriteAccess};
use starknet::{ContractAddress, get_caller_address, get_block_timestamp};
use starknet::{ContractAddress, get_caller_address};

use token_bound_accounts::components::account::account::AccountComponent;
use token_bound_accounts::interfaces::IAccount::{IAccount, IAccountDispatcherTrait};
use token_bound_accounts::interfaces::IAccount::IAccount;
use token_bound_accounts::components::account::account::AccountComponent::AccountPrivateImpl;
use token_bound_accounts::interfaces::IPermissionable::{
IPermissionable, IPermissionableDispatcher, IPermissionableDispatcherTrait
};

use openzeppelin::introspection::src5::SRC5Component;

// *************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion src/components/signatory/signatory.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pub mod SignatoryComponent {
// *************************************************************************
// IMPORTS
// *************************************************************************
use starknet::{get_caller_address, get_contract_address, ContractAddress};
use starknet::ContractAddress;
use token_bound_accounts::components::account::account::AccountComponent;
use token_bound_accounts::components::account::account::AccountComponent::AccountPrivateImpl;
use token_bound_accounts::components::account::account::AccountComponent::AccountImpl;
Expand Down
4 changes: 1 addition & 3 deletions src/components/upgradeable/upgradeable.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ pub mod UpgradeableComponent {
// *************************************************************************
// IMPORTS
// *************************************************************************
use starknet::{
ClassHash, SyscallResultTrait, get_caller_address, get_contract_address, ContractAddress
};
use starknet::{ClassHash, SyscallResultTrait, get_contract_address, ContractAddress};
use core::num::traits::zero::Zero;

use token_bound_accounts::components::account::account::AccountComponent;
Expand Down
2 changes: 0 additions & 2 deletions src/interfaces/IAccount.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// BASE ACCOUNT INTERFACE
// *************************************************************************
use starknet::ContractAddress;
use starknet::ClassHash;
use starknet::account::Call;

// SRC5 interface
pub const TBA_INTERFACE_ID: felt252 =
Expand Down
2 changes: 0 additions & 2 deletions src/interfaces/ILockable.cairo
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// *************************************************************************
// LOCKABLE INTERFACE
// *************************************************************************
use starknet::ContractAddress;

#[starknet::interface]
pub trait ILockable<TContractState> {
fn lock(ref self: TContractState, lock_until: u64);
Expand Down
2 changes: 0 additions & 2 deletions src/interfaces/ISRC6.cairo
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use starknet::ContractAddress;
use starknet::ClassHash;
use starknet::account::Call;

#[starknet::interface]
Expand Down
5 changes: 1 addition & 4 deletions src/registry/registry.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@ pub mod Registry {
use core::pedersen::PedersenTrait;
use starknet::{
ContractAddress, get_caller_address, get_contract_address,
syscalls::{call_contract_syscall, deploy_syscall}, class_hash::ClassHash,
SyscallResultTrait, storage::Map
syscalls::{call_contract_syscall, deploy_syscall}, class_hash::ClassHash, SyscallResultTrait
};

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

// *************************************************************************
Expand Down
7 changes: 3 additions & 4 deletions src/test_helper/simple_account.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use starknet::{account::Call, ContractAddress, ClassHash};
use starknet::account::Call;

#[starknet::interface]
pub trait ISimpleAccount<TContractState> {
Expand All @@ -18,9 +18,8 @@ pub mod SimpleAccount {
use starknet::storage::StoragePointerWriteAccess;
use starknet::storage::StoragePointerReadAccess;
use starknet::{
get_tx_info, get_caller_address, get_contract_address, ContractAddress, account::Call,
syscalls::call_contract_syscall, syscalls::replace_class_syscall, ClassHash,
SyscallResultTrait
get_tx_info, get_caller_address, get_contract_address, account::Call,
syscalls::call_contract_syscall
};
use core::ecdsa::check_ecdsa_signature;
use core::num::traits::zero::Zero;
Expand Down
Loading

0 comments on commit 9972361

Please sign in to comment.