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

docs: make Rust docs consistent #497

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

DarkLord017
Copy link
Contributor

@DarkLord017 DarkLord017 commented Jan 15, 2025

Resolves #476

PR Checklist

  • Tests
  • Documentation
  • Changelog

Copy link

netlify bot commented Jan 15, 2025

Deploy Preview for contracts-stylus canceled.

Name Link
🔨 Latest commit 7c41ab3
🔍 Latest deploy log https://app.netlify.com/sites/contracts-stylus/deploys/6798bc11837ea600088e2190

@DarkLord017
Copy link
Contributor Author

I also added * mark befor each event
also i have kept avery panic after events so is that ok ?

@0xNeshi
Copy link
Collaborator

0xNeshi commented Jan 17, 2025

@DarkLord017 you should also fix the failing CI

@DarkLord017
Copy link
Contributor Author

Okay

1 similar comment
@DarkLord017
Copy link
Contributor Author

Okay

@DarkLord017
Copy link
Contributor Author

@DarkLord017 you should also fix the failing CI

You can review it now

contracts/src/access/control.rs Outdated Show resolved Hide resolved
contracts/src/access/control.rs Outdated Show resolved Hide resolved
@bidzyyys bidzyyys changed the title Consistent docs docs: make Rust docs consistent Jan 20, 2025
@DarkLord017 DarkLord017 requested a review from 0xNeshi January 21, 2025 11:04
Copy link
Collaborator

@bidzyyys bidzyyys left a comment

Choose a reason for hiding this comment

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

Great job @DarkLord017.

@bidzyyys bidzyyys self-requested a review January 21, 2025 13:32
Copy link
Collaborator

@bidzyyys bidzyyys left a comment

Choose a reason for hiding this comment

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

LGTM

contracts/src/token/erc20/utils/safe_erc20.rs Outdated Show resolved Hide resolved
@DarkLord017
Copy link
Contributor Author

Great job @DarkLord017.

Thank you !

Comment on lines +199 to +201
/// NOTE: The ERC-1155 acceptance check is not performed in this function.
/// See [`Self::_update_with_acceptance_check`] instead.
///
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

Copy link
Collaborator

@0xNeshi 0xNeshi left a comment

Choose a reason for hiding this comment

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

You did a great job @DarkLord017 , most of the comments I left are related to fine-tuning the details of the original issue requirements.

Sometimes we notice the changes we want to make only once the PR is created.

Comment on lines 29 to 30
/// NOTE: In order to have [`Erc1155UriStorage::uri`] exposed in ABI,
/// you need to do this manually.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/// NOTE: In order to have [`Erc1155UriStorage::uri`] exposed in ABI,
/// you need to do this manually.
/// NOTE: To expose this function in your contract's ABI, implement it as
/// shown in the Examples section below, accepting only the `token_id`
/// parameter. The `metadata_uri` reference should come from your contract's
/// state. The implementation should forward the call to your internal
/// storage instance along with the metadata reference.

This updated NOTE section is much clearer.
All similar NOTE sections should be updated in a similar manner.

contracts/src/token/erc1155/mod.rs Outdated Show resolved Hide resolved
contracts/src/token/erc1155/mod.rs Outdated Show resolved Hide resolved
contracts/src/token/erc1155/extensions/supply.rs Outdated Show resolved Hide resolved
contracts/src/token/erc1155/mod.rs Outdated Show resolved Hide resolved
contracts/src/token/erc721/extensions/uri_storage.rs Outdated Show resolved Hide resolved
contracts/src/utils/cryptography/ecdsa.rs Outdated Show resolved Hide resolved
contracts/src/utils/introspection/erc165.rs Outdated Show resolved Hide resolved
contracts/src/utils/introspection/erc165.rs Outdated Show resolved Hide resolved
contracts/src/utils/introspection/erc165.rs Outdated Show resolved Hide resolved
@DarkLord017 DarkLord017 requested a review from 0xNeshi January 25, 2025 17:38
@DarkLord017
Copy link
Contributor Author

@0xNeshi , You can review it now

should i remove the
///should not panic ?

@0xNeshi
Copy link
Collaborator

0xNeshi commented Jan 27, 2025

@0xNeshi , You can review it now

should i remove the ///should not panic ?

Yes

@DarkLord017
Copy link
Contributor Author

done ! @0xNeshi

Copy link
Collaborator

@0xNeshi 0xNeshi left a comment

Choose a reason for hiding this comment

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

Looks great, I think we're close to getting this merged

@@ -15,26 +15,26 @@ pub trait IErc20Burnable {
/// Destroys a `value` amount of tokens from the caller, lowering the total
/// supply.
///
/// Relies on the `update` mechanism.
/// NOTE: Relies on the `update` mechanism.
Copy link
Collaborator

Choose a reason for hiding this comment

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

@DarkLord017 you can remove these notes

Comment on lines +581 to +584
/// # Requirements
///
/// * `token_id` must exist.
///
Copy link
Collaborator

Choose a reason for hiding this comment

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

@DarkLord017 remove all requirement sections

@@ -3,7 +3,7 @@
use alloy_primitives::{Address, U256};
use stylus_sdk::msg;

use crate::token::erc20::{Erc20, Error};
use crate::token::erc20::{self, Erc20, Error};
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
use crate::token::erc20::{self, Erc20, Error};
use crate::token::erc20::{self, Erc20};

Let's remove this Error import, and reference it like type Error = erc20::Error - makes it clearer that we're reusing ERC-20 errors

@@ -3,7 +3,7 @@
use alloy_primitives::{Address, U256};
use stylus_sdk::msg;

use crate::token::erc721::{Erc721, Error};
use crate::token::erc721::{self, Erc721, Error};
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
use crate::token::erc721::{self, Erc721, Error};
use crate::token::erc721::{self, Erc721};

Same as in previous comment

@@ -99,7 +102,7 @@ impl Erc721Metadata {
///
/// * [`Error::NonexistentToken`] - If the token does not exist.
///
/// # Example
/// # Examples
Copy link
Collaborator

Choose a reason for hiding this comment

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

There are other singular occurrences to update, do a global search in the repo

Comment on lines -36 to -37
/// NOTE: In order to have [`Erc1155UriStorage::uri`] exposed in ABI,
/// you need to do this manually.
Copy link
Collaborator

Choose a reason for hiding this comment

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

There are other occurrences of:

    /// NOTE: In order to have [`...`] exposed in
    /// ABI, you need to do this manually.

You can do a global search, and update all of them

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.

[Docs]: Make Rust docs consistent
4 participants