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

Upgrade the repo to Cairo v2.6 #40

Merged
merged 8 commits into from
Mar 27, 2024
Merged

Upgrade the repo to Cairo v2.6 #40

merged 8 commits into from
Mar 27, 2024

Conversation

kfastov
Copy link
Contributor

@kfastov kfastov commented Mar 24, 2024

Things already done:

  • Upgraded Starknet and Cairo dependencies to v2.6.3
  • Upgraded OpenZeppelin dependency to v0.10.0
  • Migrated ERC3525 module and its extensions to components
  • Changed the type of name and symbol methods from felt252 to ByteArray due to changes in OpenZeppelin ERC721 contract
  • Replaced set_token_uri with set_base_uri for the same reason
  • Copied OpenZeppelin test utils to this repo because import no longer works
  • Fixed tests

Things left:

  • Deploy the old contract on testnet and upgrade it
  • Update the code to use the latest features from Cairo v2.6

Will fix #39

kfastov added 3 commits March 24, 2024 13:00
Upgrade to Cairo v2.6.3
Upgrade to OpenZeppelin v0.10.0
Migrate most contracts except for presets to components (WiP)
@kfastov kfastov changed the title Migrate to components (WiP) Upgrade the repo to Cairo v2.6 Mar 25, 2024
@kfastov kfastov marked this pull request as ready for review March 26, 2024 05:53
@tekkac tekkac self-requested a review March 27, 2024 17:16
Copy link
Contributor

@tekkac tekkac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments but overall lgtm 💪
congrats on passing all the tests!

@@ -292,15 +365,18 @@ mod ERC3525 {

// [Effect] Update total value
let slot = self.slot_of(token_id);
let total = self._erc3525_total_value.read(slot);
let _total = self._erc3525_total_value.read(slot);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line might be removed I guess.

// [Effect] Merge token values
let erc721_comp = get_dep_component!(@self, ERC721);
let mut index = 0;
loop {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a while loop

impl ExternalImpl of super::IExternal<ContractState> {
fn total_value(self: @ContractState, slot: u256) -> u256 {
let unsafe_state = ERC3525::unsafe_new_contract_state();
ERC3525::InternalImpl::_total_value(@unsafe_state, slot)
self.erc3525._total_value(slot)
}

fn mint(ref self: ContractState, to: ContractAddress, slot: u256, value: u256) -> u256 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this have been a IERC3525MintableComponent component too? ?

@tekkac tekkac merged commit 7d1f276 into carbonable-labs:main Mar 27, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Refactor/Upgrade] Migrate the all repository from Cairo 2.2.0 to 2.6.0 - Big Issue
2 participants