Skip to content

Commit

Permalink
fix: clippy linting
Browse files Browse the repository at this point in the history
  • Loading branch information
bidzyyys committed Apr 30, 2024
1 parent 7f8459b commit fb6684b
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
7 changes: 1 addition & 6 deletions contracts/src/erc20/extensions/burnable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ mod tests {
impl IERC20Burnable for ERC20 {}

sol_storage! {
#[derive(Default)]
pub struct TestERC20Burnable {
ERC20 erc20;
}
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions contracts/src/erc20/extensions/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions contracts/src/erc20/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions contracts/src/utils/capped.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -23,17 +24,21 @@ sol_storage! {
sol! {
/// Emitted when `_cap` is set to `cap` value
/// by an `account`.
#[allow(missing_docs)]
event Cap(address indexed account, uint256 cap);
}

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);
}

Expand Down
9 changes: 2 additions & 7 deletions contracts/src/utils/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
5 changes: 5 additions & 0 deletions contracts/src/utils/pausable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}

Expand All @@ -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)]
Expand Down

0 comments on commit fb6684b

Please sign in to comment.