Skip to content

Commit

Permalink
lint: fix primarily overly-long lines
Browse files Browse the repository at this point in the history
  • Loading branch information
jordaniza committed Feb 29, 2024
1 parent 6d4bc88 commit 96bb242
Show file tree
Hide file tree
Showing 9 changed files with 147 additions and 69 deletions.
6 changes: 5 additions & 1 deletion packages/contracts/src/ERC20/governance/GovernanceERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

pragma solidity ^0.8.8;

/* solhint-disable max-line-length */
import {IERC20PermitUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol";
import {IERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import {IERC20MetadataUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol";
Expand All @@ -14,9 +15,12 @@ import {DaoAuthorizableUpgradeable} from "@aragon/osx-commons-contracts/src/perm
import {IDAO} from "@aragon/osx-commons-contracts/src/dao/IDAO.sol";
import {IERC20MintableUpgradeable} from "../IERC20MintableUpgradeable.sol";

/* solhint-enable max-line-length */

/// @title GovernanceERC20
/// @author Aragon Association
/// @notice An [OpenZeppelin `Votes`](https://docs.openzeppelin.com/contracts/4.x/api/governance#Votes) compatible [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token that can be used for voting and is managed by a DAO.
/// @notice An [OpenZeppelin `Votes`](https://docs.openzeppelin.com/contracts/4.x/api/governance#Votes)
/// compatible [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token, used for voting and managed by a DAO.
/// @custom:security-contact [email protected]
contract GovernanceERC20 is
IERC20MintableUpgradeable,
Expand Down
24 changes: 16 additions & 8 deletions packages/contracts/src/ERC20/governance/GovernanceWrappedERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

pragma solidity ^0.8.8;

/* solhint-disable max-line-length */
import {ERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import {ERC20WrapperUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20WrapperUpgradeable.sol";
import {IVotesUpgradeable} from "@openzeppelin/contracts-upgradeable/governance/utils/IVotesUpgradeable.sol";
Expand All @@ -11,19 +12,26 @@ import {IERC20MetadataUpgradeable} from "@openzeppelin/contracts-upgradeable/tok
import {ERC20VotesUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20VotesUpgradeable.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {ERC165Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol";

import {DaoAuthorizableUpgradeable} from "@aragon/osx-commons-contracts/src/permission/auth/DaoAuthorizableUpgradeable.sol";
import {IDAO} from "@aragon/osx-commons-contracts/src/dao/IDAO.sol";
import {IGovernanceWrappedERC20} from "./IGovernanceWrappedERC20.sol";

/* solhint-enable max-line-length */

/// @title GovernanceWrappedERC20
/// @author Aragon Association
/// @notice Wraps an existing [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token by inheriting from `ERC20WrapperUpgradeable` and allows to use it for voting by inheriting from `ERC20VotesUpgradeable`. The latter is compatible with [OpenZeppelin's `Votes`](https://docs.openzeppelin.com/contracts/4.x/api/governance#Votes) interface.
/// The contract also supports meta transactions. To use an `amount` of underlying tokens for voting, the token owner has to
/// @notice Wraps an existing [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token by
/// inheriting from `ERC20WrapperUpgradeable` and allows using it for voting by inheriting from `ERC20VotesUpgradeable`.
/// The latter is compatible with
/// [OpenZeppelin's `Votes`](https://docs.openzeppelin.com/contracts/4.x/api/governance#Votes) interface.
/// The contract supports meta transactions. To use an `amount` of underlying tokens for voting, the token owner must:
/// 1. call `approve` for the tokens to be used by this contract
/// 2. call `depositFor` to wrap them, which safely transfers the underlying [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens to the contract and mints wrapped [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens.
/// To get the [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens back, the owner of the wrapped tokens can call `withdrawFor`, which burns the wrapped [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens and safely transfers the underlying tokens back to the owner.
/// @dev This contract intentionally has no public mint functionality because this is the responsibility of the underlying [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token contract.
/// 2. call `depositFor` to wrap them, which safely transfers the underlying
/// [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens to the contract and mints wrapped
/// [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens.
/// To get the [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens back, the owner of the wrapped tokens can call
/// `withdrawFor`, which burns the wrapped [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens and
/// safely transfers the underlying tokens back to the owner.
/// @dev This contract intentionally has no public mint functionality because this is the
/// responsibility of the underlying [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token contract.
/// @custom:security-contact [email protected]
contract GovernanceWrappedERC20 is
IGovernanceWrappedERC20,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@

pragma solidity ^0.8.8;

import {IERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import {ERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import {ERC20WrapperUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20WrapperUpgradeable.sol";

/// @title IGovernanceWrappedERC20
/// @author Aragon Association
/// @notice An interface for the token wrapping contract wrapping existing [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens.
/// @notice An interface for the token wrapping contract wrapping existing
/// [ERC-20](https://eips.ethereum.org/EIPS/eip-20) tokens.
/// @custom:security-contact [email protected]
interface IGovernanceWrappedERC20 {
/// @notice Deposits an amount of underlying token and mints the corresponding number of wrapped tokens for a receiving address.
/// @notice Deposits an amount of underlying token
/// and mints the corresponding number of wrapped tokens for a receiving address.
/// @param account The address receiving the minted, wrapped tokens.
/// @param amount The amount of tokens to deposit.
function depositFor(address account, uint256 amount) external returns (bool);

/// @notice Withdraws an amount of underlying tokens to a receiving address and burns the corresponding number of wrapped tokens.
/// @notice Withdraws an amount of underlying tokens to a receiving address
/// and burns the corresponding number of wrapped tokens.
/// @param account The address receiving the withdrawn, underlying tokens.
/// @param amount The amount of underlying tokens to withdraw.
function withdrawTo(address account, uint256 amount) external returns (bool);
Expand Down
23 changes: 15 additions & 8 deletions packages/contracts/src/IMajorityVoting.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

pragma solidity ^0.8.8;

import {IDAO} from "@aragon/osx-commons-contracts/src/dao/IDAO.sol";

/// @title IMajorityVoting
/// @author Aragon Association - 2022-2023
/// @notice The interface of majority voting plugin.
/// @custom:security-contact [email protected]
interface IMajorityVoting {
/// @notice Vote options that a voter can chose from.
/// @param None The default option state of a voter indicating the absence from the vote. This option neither influences support nor participation.
/// @param None The default option state of a voter indicating the absence from the vote.
/// This option neither influences support nor participation.
/// @param Abstain This option does not influence the support but counts towards participation.
/// @param Yes This option increases the support and counts towards participation.
/// @param No This option decreases the support and counts towards participation.
Expand Down Expand Up @@ -41,17 +40,23 @@ interface IMajorityVoting {
/// @return The minimum participation parameter.
function minParticipation() external view returns (uint32);

/// @notice Checks if the support value defined as $$\texttt{support} = \frac{N_\text{yes}}{N_\text{yes}+N_\text{no}}$$ for a proposal vote is greater than the support threshold.
/// @notice Checks if the support value defined as:
/// $$\texttt{support} = \frac{N_\text{yes}}{N_\text{yes}+N_\text{no}}$$
/// for a proposal vote is greater than the support threshold.
/// @param _proposalId The ID of the proposal.
/// @return Returns `true` if the support is greater than the support threshold and `false` otherwise.
function isSupportThresholdReached(uint256 _proposalId) external view returns (bool);

/// @notice Checks if the worst-case support value defined as $$\texttt{worstCaseSupport} = \frac{N_\text{yes}}{ N_\text{total}-N_\text{abstain}}$$ for a proposal vote is greater than the support threshold.
/// @notice Checks if the worst-case support value defined as:
/// $$\texttt{worstCaseSupport} = \frac{N_\text{yes}}{ N_\text{total}-N_\text{abstain}}$$
/// for a proposal vote is greater than the support threshold.
/// @param _proposalId The ID of the proposal.
/// @return Returns `true` if the worst-case support is greater than the support threshold and `false` otherwise.
function isSupportThresholdReachedEarly(uint256 _proposalId) external view returns (bool);

/// @notice Checks if the participation value defined as $$\texttt{participation} = \frac{N_\text{yes}+N_\text{no}+N_\text{abstain}}{N_\text{total}}$$ for a proposal vote is greater or equal than the minimum participation value.
/// @notice Checks if the participation value defined as:
/// $$\texttt{participation} = \frac{N_\text{yes}+N_\text{no}+N_\text{abstain}}{N_\text{total}}$$
/// for a proposal vote is greater or equal than the minimum participation value.
/// @param _proposalId The ID of the proposal.
/// @return Returns `true` if the participation is greater than the minimum participation and `false` otherwise.
function isMinParticipationReached(uint256 _proposalId) external view returns (bool);
Expand Down Expand Up @@ -81,14 +86,16 @@ interface IMajorityVoting {
/// @dev `_voteOption`, 1 -> abstain, 2 -> yes, 3 -> no
/// @param _proposalId The ID of the proposal.
/// @param _voteOption The chosen vote option.
/// @param _tryEarlyExecution If `true`, early execution is tried after the vote cast. The call does not revert if early execution is not possible.
/// @param _tryEarlyExecution If `true`, early execution is tried after the vote cast.
/// The call does not revert if early execution is not possible.
function vote(uint256 _proposalId, VoteOption _voteOption, bool _tryEarlyExecution) external;

/// @notice Executes a proposal.
/// @param _proposalId The ID of the proposal to be executed.
function execute(uint256 _proposalId) external;

/// @notice Returns whether the account has voted for the proposal. Note, that this does not check if the account has voting power.
/// @notice Returns whether the account has voted for the proposal.
/// Note, that this does not check if the account has voting power.
/// @param _proposalId The ID of the proposal.
/// @param _account The account address to be checked.
/// @return The vote option cast by a voter for a certain proposal.
Expand Down
Loading

0 comments on commit 96bb242

Please sign in to comment.