From 7cd11abba9c9614e99d904febb8cf257a6482ab0 Mon Sep 17 00:00:00 2001 From: Gustavo Gonzalez Date: Thu, 15 Aug 2024 16:26:58 -0300 Subject: [PATCH] Change ABI suffix to Trait in dual case account and eth account traits (#1096) * Change ABI suffix to Trait in dual case account and eth account traits * Add changelog * Update CHANGELOG.md Co-authored-by: Eric Nordelo * remove new line from changelog * fix lint * fix lint --------- Co-authored-by: Eric Nordelo --- CHANGELOG.md | 9 ++++++++- docs/modules/ROOT/pages/guides/snip12.adoc | 2 +- packages/account/src/dual_account.cairo | 4 ++-- packages/account/src/dual_eth_account.cairo | 4 ++-- packages/account/src/tests/test_dual_account.cairo | 2 +- packages/account/src/tests/test_dual_eth_account.cairo | 2 +- packages/token/src/erc20/extensions/erc20_votes.cairo | 2 +- 7 files changed, 16 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87b883377..837ed7e3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ + # Changelog All notable changes to this project will be documented in this file. @@ -8,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Changed (Breaking) + +- Changed ABI suffix to Trait in dual case account and eth account modules (#1096). + - `DualCaseAccountABI` renamed to `DualCaseAccountTrait` + - `DualCaseEthAccountABI` renamed to `DualCaseEthAccountTrait` + ## 0.15.1 (2024-08-13) ### Changed @@ -70,7 +77,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `Trace` and `Checkpoint` structs are not public anymore, since they are intended to be used in `ERC20Votes`, and not as generic utilities. - `StorageArray` is not public anymore, since this implementation is specific to `ERC20Votes`, and is not intended as a generic utility, but as a temporary solution until Starknet native implementation arrives. -- Apply underscore pattern to modules (#993) +- Apply underscore pattern to modules (#993): - AccessControlComponent - `_set_role_admin` function renamed to `set_role_admin` - PausableComponent diff --git a/docs/modules/ROOT/pages/guides/snip12.adoc b/docs/modules/ROOT/pages/guides/snip12.adoc index fb919e065..2cf8e9b88 100644 --- a/docs/modules/ROOT/pages/guides/snip12.adoc +++ b/docs/modules/ROOT/pages/guides/snip12.adoc @@ -278,7 +278,7 @@ impl StructHashImpl of StructHash { #[starknet::contract] mod CustomERC20 { - use openzeppelin::account::dual_account::{DualCaseAccount, DualCaseAccountABI}; + use openzeppelin::account::dual_account::{DualCaseAccount, DualCaseAccountTrait}; use openzeppelin::token::erc20::{ERC20Component, ERC20HooksEmptyImpl}; use openzeppelin::utils::cryptography::nonces::NoncesComponent; use starknet::ContractAddress; diff --git a/packages/account/src/dual_account.cairo b/packages/account/src/dual_account.cairo index ae0d33cc7..206fa42f5 100644 --- a/packages/account/src/dual_account.cairo +++ b/packages/account/src/dual_account.cairo @@ -14,7 +14,7 @@ pub struct DualCaseAccount { pub contract_address: ContractAddress } -pub trait DualCaseAccountABI { +pub trait DualCaseAccountTrait { fn set_public_key(self: @DualCaseAccount, new_public_key: felt252, signature: Span); fn get_public_key(self: @DualCaseAccount) -> felt252; fn is_valid_signature( @@ -23,7 +23,7 @@ pub trait DualCaseAccountABI { fn supports_interface(self: @DualCaseAccount, interface_id: felt252) -> bool; } -impl DualCaseAccountImpl of DualCaseAccountABI { +impl DualCaseAccountImpl of DualCaseAccountTrait { fn set_public_key(self: @DualCaseAccount, new_public_key: felt252, signature: Span) { let mut args = array![new_public_key]; args.append_serde(signature); diff --git a/packages/account/src/dual_eth_account.cairo b/packages/account/src/dual_eth_account.cairo index 9b7d5138a..d11b98452 100644 --- a/packages/account/src/dual_eth_account.cairo +++ b/packages/account/src/dual_eth_account.cairo @@ -15,7 +15,7 @@ pub struct DualCaseEthAccount { pub contract_address: ContractAddress } -pub trait DualCaseEthAccountABI { +pub trait DualCaseEthAccountTrait { fn set_public_key( self: @DualCaseEthAccount, new_public_key: EthPublicKey, signature: Span ); @@ -26,7 +26,7 @@ pub trait DualCaseEthAccountABI { fn supports_interface(self: @DualCaseEthAccount, interface_id: felt252) -> bool; } -impl DualCaseEthAccountImpl of DualCaseEthAccountABI { +impl DualCaseEthAccountImpl of DualCaseEthAccountTrait { fn set_public_key( self: @DualCaseEthAccount, new_public_key: EthPublicKey, signature: Span ) { diff --git a/packages/account/src/tests/test_dual_account.cairo b/packages/account/src/tests/test_dual_account.cairo index b157d2ba4..c1089e022 100644 --- a/packages/account/src/tests/test_dual_account.cairo +++ b/packages/account/src/tests/test_dual_account.cairo @@ -1,4 +1,4 @@ -use openzeppelin_account::dual_account::{DualCaseAccountABI, DualCaseAccount}; +use openzeppelin_account::dual_account::{DualCaseAccountTrait, DualCaseAccount}; use openzeppelin_account::interface::{AccountABIDispatcherTrait, AccountABIDispatcher}; use openzeppelin_introspection::interface::ISRC5_ID; diff --git a/packages/account/src/tests/test_dual_eth_account.cairo b/packages/account/src/tests/test_dual_eth_account.cairo index 165442cef..7a4d04847 100644 --- a/packages/account/src/tests/test_dual_eth_account.cairo +++ b/packages/account/src/tests/test_dual_eth_account.cairo @@ -1,4 +1,4 @@ -use openzeppelin_account::dual_eth_account::{DualCaseEthAccount, DualCaseEthAccountABI}; +use openzeppelin_account::dual_eth_account::{DualCaseEthAccountTrait, DualCaseEthAccount}; use openzeppelin_account::interface::{EthAccountABIDispatcherTrait, EthAccountABIDispatcher}; use openzeppelin_account::utils::secp256k1::{DebugSecp256k1Point, Secp256k1PointPartialEq}; use openzeppelin_introspection::interface::ISRC5_ID; diff --git a/packages/token/src/erc20/extensions/erc20_votes.cairo b/packages/token/src/erc20/extensions/erc20_votes.cairo index d799cbeea..b13cd160d 100644 --- a/packages/token/src/erc20/extensions/erc20_votes.cairo +++ b/packages/token/src/erc20/extensions/erc20_votes.cairo @@ -17,7 +17,7 @@ use starknet::ContractAddress; #[starknet::component] pub mod ERC20VotesComponent { use core::num::traits::Zero; - use openzeppelin_account::dual_account::{DualCaseAccount, DualCaseAccountABI}; + use openzeppelin_account::dual_account::{DualCaseAccount, DualCaseAccountTrait}; use openzeppelin_governance::utils::interfaces::IVotes; use openzeppelin_token::erc20::ERC20Component; use openzeppelin_token::erc20::interface::IERC20;