diff --git a/contracts/src/erc20/extensions/burnable.rs b/contracts/src/erc20/extensions/burnable.rs index 000ee6819..849208822 100644 --- a/contracts/src/erc20/extensions/burnable.rs +++ b/contracts/src/erc20/extensions/burnable.rs @@ -143,6 +143,7 @@ mod tests { impl IERC20Burnable for ERC20 {} sol_storage! { + #[derive(Default)] pub struct TestERC20Burnable { ERC20 erc20; } @@ -153,12 +154,6 @@ mod tests { erc20_burnable_impl!(); } - impl Default for TestERC20Burnable { - fn default() -> Self { - Self { erc20: ERC20::default() } - } - } - #[grip::test] fn burns(contract: TestERC20Burnable) { let zero = U256::ZERO; diff --git a/contracts/src/erc20/extensions/metadata.rs b/contracts/src/erc20/extensions/metadata.rs index baa995316..960a01a3d 100644 --- a/contracts/src/erc20/extensions/metadata.rs +++ b/contracts/src/erc20/extensions/metadata.rs @@ -8,6 +8,7 @@ pub const DEFAULT_DECIMALS: u8 = 18; sol_storage! { /// Optional metadata of the ERC-20 standard. + #[allow(clippy::pub_underscore_fields)] pub struct Metadata { /// Token name. string _name; diff --git a/contracts/src/erc20/mod.rs b/contracts/src/erc20/mod.rs index 44d1dd036..2a29f6fee 100644 --- a/contracts/src/erc20/mod.rs +++ b/contracts/src/erc20/mod.rs @@ -103,6 +103,7 @@ macro_rules! erc20_impl { sol_storage! { /// State of an ERC20 token. + #[allow(clippy::pub_underscore_fields)] pub struct ERC20 { /// Maps users to balances. mapping(address => uint256) _balances; diff --git a/contracts/src/utils/capped.rs b/contracts/src/utils/capped.rs index 442db3ac3..95c4d5f4c 100644 --- a/contracts/src/utils/capped.rs +++ b/contracts/src/utils/capped.rs @@ -14,6 +14,7 @@ use stylus_sdk::{evm, msg}; sol_storage! { /// State of a Capped Contract. + #[allow(clippy::pub_underscore_fields)] pub struct Capped { /// A cap to the supply of tokens. uint256 _cap; @@ -23,6 +24,7 @@ sol_storage! { sol! { /// Emitted when `_cap` is set to `cap` value /// by an `account`. + #[allow(missing_docs)] event Cap(address indexed account, uint256 cap); } @@ -30,10 +32,13 @@ sol! { /// Indicates an error related to the operation that failed /// because `total_supply` exceeded the `_cap`. #[derive(Debug)] + #[allow(missing_docs)] error ExceededCap(uint256 increasedSupply, uint256 cap); + /// Indicates an error related to the operation that failed /// because the supplied `cap` is not a valid cap value. #[derive(Debug)] + #[allow(missing_docs)] error InvalidCap(uint256 cap); } diff --git a/contracts/src/utils/mod.rs b/contracts/src/utils/mod.rs index 8dbce4c03..0b017c108 100644 --- a/contracts/src/utils/mod.rs +++ b/contracts/src/utils/mod.rs @@ -1,9 +1,4 @@ -//! TODO docs - -// cfg_if::cfg_if! { -// if #[cfg(any(test, feature = "erc20_pausable"))] { -pub mod pausable; -// } -// } +//! Smart Contracts for building tokens' extensions. pub mod capped; +pub mod pausable; diff --git a/contracts/src/utils/pausable.rs b/contracts/src/utils/pausable.rs index e87a2e7da..0cc87584a 100644 --- a/contracts/src/utils/pausable.rs +++ b/contracts/src/utils/pausable.rs @@ -17,6 +17,7 @@ use stylus_sdk::{evm, msg}; sol_storage! { /// State of a Pausable Contract. + #[allow(clippy::pub_underscore_fields)] pub struct Pausable { /// Indicates whether the contract is `Paused`. bool _paused; @@ -25,8 +26,11 @@ sol_storage! { sol! { /// Emitted when the `Pause` is triggered by an `account`. + #[allow(missing_docs)] event Paused(address indexed account); + /// Emitted when the `Unpause` is lifted by an `account`. + #[allow(missing_docs)] event Unpaused(address indexed account); } @@ -35,6 +39,7 @@ sol! { /// because the contract had been in `Paused` state. #[derive(Debug)] error EnforcedPause(); + /// Indicates an error related to the operation that failed /// because the contract had been in `Unpaused` state. #[derive(Debug)]