From aa9f3015fe224c44430ffa4429197292ffdfb099 Mon Sep 17 00:00:00 2001 From: David Roon Date: Fri, 22 Mar 2024 16:38:35 +0100 Subject: [PATCH] npm run lint:fix --- contracts/adapters/BankAdapter.sol | 24 ++- contracts/adapters/Configuration.sol | 9 +- contracts/adapters/CouponBurn.sol | 9 +- contracts/adapters/CouponOnboarding.sol | 9 +- contracts/adapters/DaoRegistryAdapter.sol | 8 +- contracts/adapters/Distribute.sol | 18 +- contracts/adapters/Financing.sol | 9 +- contracts/adapters/GuildKick.sol | 9 +- contracts/adapters/KycOnboarding.sol | 27 ++- contracts/adapters/LendNFT.sol | 30 ++-- contracts/adapters/Manager.sol | 40 ++--- contracts/adapters/Managing.sol | 23 +-- contracts/adapters/Onboarding.sol | 19 +- contracts/adapters/Signatures.sol | 9 +- contracts/adapters/Tribute.sol | 16 +- contracts/adapters/TributeNFT.sol | 30 ++-- contracts/adapters/interfaces/IOnboarding.sol | 7 +- contracts/adapters/interfaces/IVoting.sol | 7 +- .../adapters/modifiers/ReimbursableLib.sol | 7 +- .../voting/KickBadReporterAdapter.sol | 8 +- contracts/adapters/voting/OffchainVoting.sol | 63 +++---- .../adapters/voting/OffchainVotingHash.sol | 16 +- .../voting/SnapshotProposalContract.sol | 49 ++---- contracts/adapters/voting/Voting.sol | 10 +- contracts/companion/GelatoBytes.sol | 33 ++-- contracts/companion/Reimbursement.sol | 10 +- .../companion/interfaces/IReimbursement.sol | 8 +- contracts/core/CloneFactory.sol | 16 +- contracts/core/DaoFactory.sol | 15 +- contracts/core/DaoRegistry.sol | 165 ++++++++---------- contracts/extensions/bank/Bank.sol | 62 +++---- contracts/extensions/bank/BankFactory.sol | 17 +- .../erc1155/ERC1155TokenExtension.sol | 36 ++-- .../erc1155/ERC1155TokenExtensionFactory.sol | 9 +- contracts/extensions/erc1271/ERC1271.sol | 10 +- .../extensions/erc1271/ERC1271Factory.sol | 9 +- contracts/extensions/executor/Executor.sol | 8 +- .../extensions/executor/ExecutorFactory.sol | 9 +- contracts/extensions/nft/NFT.sol | 27 ++- .../extensions/nft/NFTCollectionFactory.sol | 9 +- .../token/erc20/ERC20TokenExtension.sol | 46 ++--- .../erc20/ERC20TokenExtensionFactory.sol | 9 +- .../erc20/ERC20TransferStrategySimple.sol | 9 +- .../ERC20TransferStrategyWithVesting.sol | 9 +- .../erc20/InternalTokenVestingExtension.sol | 9 +- .../InternalTokenVestingExtensionFactory.sol | 9 +- contracts/guards/MemberGuard.sol | 9 +- contracts/helpers/DaoHelper.sol | 39 ++--- contracts/nft/TributeERC721.sol | 35 ++-- contracts/test/ERC1155TestToken.sol | 4 +- contracts/test/OLToken.sol | 9 +- contracts/test/PixelNFT.sol | 6 +- contracts/test/TestToken1.sol | 2 +- contracts/test/TestToken2.sol | 2 +- contracts/test/TributeERC721V2.sol | 35 ++-- contracts/utils/Multicall.sol | 15 +- contracts/utils/Signatures.sol | 9 +- 57 files changed, 491 insertions(+), 664 deletions(-) diff --git a/contracts/adapters/BankAdapter.sol b/contracts/adapters/BankAdapter.sol index db68be36e..0888b24ce 100644 --- a/contracts/adapters/BankAdapter.sol +++ b/contracts/adapters/BankAdapter.sol @@ -47,10 +47,10 @@ contract BankAdapterContract is AdapterGuard, Reimbursable { * @param dao The DAO address. * @param token The token address to receive the funds. */ - function withdraw(DaoRegistry dao, address token) - external - reimbursable(dao) - { + function withdraw( + DaoRegistry dao, + address token + ) external reimbursable(dao) { address account = DaoHelper.msgSender(dao, msg.sender); require( DaoHelper.isNotReservedAddress(account), @@ -80,11 +80,9 @@ contract BankAdapterContract is AdapterGuard, Reimbursable { ); } - function stringToBytes32(string memory source) - public - pure - returns (bytes32 result) - { + function stringToBytes32( + string memory source + ) public pure returns (bytes32 result) { bytes memory tempEmptyStringTest = bytes(source); if (tempEmptyStringTest.length == 0) { return 0x0; @@ -101,10 +99,10 @@ contract BankAdapterContract is AdapterGuard, Reimbursable { * @param dao The DAO address. * @param token The token address to update. */ - function updateToken(DaoRegistry dao, address token) - external - reentrancyGuard(dao) - { + function updateToken( + DaoRegistry dao, + address token + ) external reentrancyGuard(dao) { // We do not need to check if the token is supported by the bank, // because if it is not, the balance will always be zero. BankExtension(dao.getExtensionAddress(DaoHelper.BANK)).updateToken( diff --git a/contracts/adapters/Configuration.sol b/contracts/adapters/Configuration.sol index 71b0ae923..d4a7a68dc 100644 --- a/contracts/adapters/Configuration.sol +++ b/contracts/adapters/Configuration.sol @@ -90,11 +90,10 @@ contract ConfigurationContract is IConfiguration, AdapterGuard, Reimbursable { * @param proposalId The proposal id. */ // slither-disable-next-line reentrancy-benign - function processProposal(DaoRegistry dao, bytes32 proposalId) - external - override - reimbursable(dao) - { + function processProposal( + DaoRegistry dao, + bytes32 proposalId + ) external override reimbursable(dao) { dao.processProposal(proposalId); IVoting votingContract = IVoting(dao.votingAdapter(proposalId)); diff --git a/contracts/adapters/CouponBurn.sol b/contracts/adapters/CouponBurn.sol index 4ab6f123c..62bbf4e7d 100644 --- a/contracts/adapters/CouponBurn.sol +++ b/contracts/adapters/CouponBurn.sol @@ -81,11 +81,10 @@ contract CouponBurnContract is Reimbursable, AdapterGuard, Signatures { * @param dao is the DAO instance to be configured * @param coupon is the coupon to hash */ - function hashCouponMessage(DaoRegistry dao, Coupon memory coupon) - public - view - returns (bytes32) - { + function hashCouponMessage( + DaoRegistry dao, + Coupon memory coupon + ) public view returns (bytes32) { bytes32 message = keccak256( abi.encode( COUPON_MESSAGE_TYPEHASH, diff --git a/contracts/adapters/CouponOnboarding.sol b/contracts/adapters/CouponOnboarding.sol index 6ccfa74b9..1d18a2811 100644 --- a/contracts/adapters/CouponOnboarding.sol +++ b/contracts/adapters/CouponOnboarding.sol @@ -105,11 +105,10 @@ contract CouponOnboardingContract is Reimbursable, AdapterGuard, Signatures { * @param dao is the DAO instance to be configured * @param coupon is the coupon to hash */ - function hashCouponMessage(DaoRegistry dao, Coupon memory coupon) - public - view - returns (bytes32) - { + function hashCouponMessage( + DaoRegistry dao, + Coupon memory coupon + ) public view returns (bytes32) { bytes32 message = keccak256( abi.encode( COUPON_MESSAGE_TYPEHASH, diff --git a/contracts/adapters/DaoRegistryAdapter.sol b/contracts/adapters/DaoRegistryAdapter.sol index ae8a7acb2..d906feff3 100644 --- a/contracts/adapters/DaoRegistryAdapter.sol +++ b/contracts/adapters/DaoRegistryAdapter.sol @@ -38,10 +38,10 @@ contract DaoRegistryAdapterContract is MemberGuard, AdapterGuard { * @param dao The DAO address. * @param delegateKey the new delegate key. */ - function updateDelegateKey(DaoRegistry dao, address delegateKey) - external - reentrancyGuard(dao) - { + function updateDelegateKey( + DaoRegistry dao, + address delegateKey + ) external reentrancyGuard(dao) { address dk = dao.getCurrentDelegateKey(msg.sender); if (dk != msg.sender && dao.isMember(dk)) { dao.updateDelegateKey(msg.sender, delegateKey); diff --git a/contracts/adapters/Distribute.sol b/contracts/adapters/Distribute.sol index 3a4a62940..b610b64b4 100644 --- a/contracts/adapters/Distribute.sol +++ b/contracts/adapters/Distribute.sol @@ -154,11 +154,10 @@ contract DistributeContract is IDistribute, AdapterGuard, Reimbursable { // The function is protected against reentrancy with the reentrancyGuard // Which prevents concurrent modifications in the DAO registry. //slither-disable-next-line reentrancy-no-eth - function processProposal(DaoRegistry dao, bytes32 proposalId) - external - override - reimbursable(dao) - { + function processProposal( + DaoRegistry dao, + bytes32 proposalId + ) external override reimbursable(dao) { dao.processProposal(proposalId); // Checks if the proposal exists or is not in progress yet. @@ -223,11 +222,10 @@ contract DistributeContract is IDistribute, AdapterGuard, Reimbursable { * @param toIndex The index to control the cached for-loop. */ // slither-disable-next-line reentrancy-benign - function distribute(DaoRegistry dao, uint256 toIndex) - external - override - reimbursable(dao) - { + function distribute( + DaoRegistry dao, + uint256 toIndex + ) external override reimbursable(dao) { // Checks if the proposal does not exist or is not completed yet bytes32 ongoingProposalId = ongoingDistributions[address(dao)]; Distribution storage distribution = distributions[address(dao)][ diff --git a/contracts/adapters/Financing.sol b/contracts/adapters/Financing.sol index 1e9f0f951..cc9cc6fd4 100644 --- a/contracts/adapters/Financing.sol +++ b/contracts/adapters/Financing.sol @@ -105,11 +105,10 @@ contract FinancingContract is IFinancing, AdapterGuard, Reimbursable { * @param proposalId The proposal id. */ // slither-disable-next-line reentrancy-benign - function processProposal(DaoRegistry dao, bytes32 proposalId) - external - override - reimbursable(dao) - { + function processProposal( + DaoRegistry dao, + bytes32 proposalId + ) external override reimbursable(dao) { ProposalDetails memory details = proposals[address(dao)][proposalId]; IVoting votingContract = IVoting(dao.votingAdapter(proposalId)); diff --git a/contracts/adapters/GuildKick.sol b/contracts/adapters/GuildKick.sol index 0c4146acd..e1a031db6 100644 --- a/contracts/adapters/GuildKick.sol +++ b/contracts/adapters/GuildKick.sol @@ -113,11 +113,10 @@ contract GuildKickContract is IGuildKick, AdapterGuard, Reimbursable { * @param dao The dao address. * @param proposalId The guild kick proposal id. */ - function processProposal(DaoRegistry dao, bytes32 proposalId) - external - override - reimbursable(dao) - { + function processProposal( + DaoRegistry dao, + bytes32 proposalId + ) external override reimbursable(dao) { dao.processProposal(proposalId); // Checks if the proposal has passed. diff --git a/contracts/adapters/KycOnboarding.sol b/contracts/adapters/KycOnboarding.sol index 94f71cd74..d0502e018 100644 --- a/contracts/adapters/KycOnboarding.sol +++ b/contracts/adapters/KycOnboarding.sol @@ -184,11 +184,10 @@ contract KycOnboardingContract is AdapterGuard, MemberGuard, Signatures { * @param dao is the DAO instance to be configured * @param coupon is the coupon to hash */ - function hashCouponMessage(DaoRegistry dao, Coupon memory coupon) - public - view - returns (bytes32) - { + function hashCouponMessage( + DaoRegistry dao, + Coupon memory coupon + ) public view returns (bytes32) { bytes32 message = keccak256( abi.encode( COUPON_MESSAGE_TYPEHASH, @@ -449,22 +448,20 @@ contract KycOnboardingContract is AdapterGuard, MemberGuard, Signatures { * @param tokenAddrToMint The address to encode. * @param key The key to encode. */ - function _configKey(address tokenAddrToMint, bytes32 key) - internal - pure - returns (bytes32) - { + function _configKey( + address tokenAddrToMint, + bytes32 key + ) internal pure returns (bytes32) { return keccak256(abi.encode(tokenAddrToMint, key)); } /** * @notice Returns if a dao allows kyc top ups. */ - function _daoCanTopUp(DaoRegistry dao, address tokenAddr) - internal - view - returns (bool) - { + function _daoCanTopUp( + DaoRegistry dao, + address tokenAddr + ) internal view returns (bool) { return dao.getConfiguration(_configKey(tokenAddr, CanTopUp)) > 0; } } diff --git a/contracts/adapters/LendNFT.sol b/contracts/adapters/LendNFT.sol index 881d2fa46..281ec7870 100644 --- a/contracts/adapters/LendNFT.sol +++ b/contracts/adapters/LendNFT.sol @@ -81,10 +81,10 @@ contract LendNFTContract is * @param dao The DAO address. * @param token The token address that will be configured as internal token. */ - function configureDao(DaoRegistry dao, address token) - external - onlyAdapter(dao) - { + function configureDao( + DaoRegistry dao, + address token + ) external onlyAdapter(dao) { BankExtension(dao.getExtensionAddress(DaoHelper.BANK)) .registerPotentialNewInternalToken(dao, token); } @@ -162,7 +162,10 @@ contract LendNFTContract is // The function can be called only from the _onERC1155Received & _onERC721Received functions // Which are protected against reentrancy attacks. //slither-disable-next-line reentrancy-no-eth - function _processProposal(DaoRegistry dao, bytes32 proposalId) + function _processProposal( + DaoRegistry dao, + bytes32 proposalId + ) internal returns ( ProposalDetails storage proposal, @@ -235,10 +238,10 @@ contract LendNFTContract is * @notice Sends the NFT back to the original owner. */ // slither-disable-next-line reentrancy-benign - function sendNFTBack(DaoRegistry dao, bytes32 proposalId) - external - reimbursable(dao) - { + function sendNFTBack( + DaoRegistry dao, + bytes32 proposalId + ) external reimbursable(dao) { ProposalDetails storage proposal = proposals[address(dao)][proposalId]; require(proposal.lendingStart > 0, "lending not started"); require(!proposal.sentBack, "already sent back"); @@ -424,12 +427,9 @@ contract LendNFTContract is * @notice Supports ERC-165 & ERC-1155 interfaces only. * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1155.md */ - function supportsInterface(bytes4 interfaceID) - external - pure - override - returns (bool) - { + function supportsInterface( + bytes4 interfaceID + ) external pure override returns (bool) { return interfaceID == this.supportsInterface.selector || interfaceID == this.onERC1155Received.selector || diff --git a/contracts/adapters/Manager.sol b/contracts/adapters/Manager.sol index d8ba92973..0d88c5608 100644 --- a/contracts/adapters/Manager.sol +++ b/contracts/adapters/Manager.sol @@ -95,10 +95,10 @@ contract Manager is Reimbursable, AdapterGuard, Signatures { * @notice Configures the Adapter with the managing signer address. * @param signerAddress the address of the managing signer */ - function configureDao(DaoRegistry dao, address signerAddress) - external - onlyAdapter(dao) - { + function configureDao( + DaoRegistry dao, + address signerAddress + ) external onlyAdapter(dao) { dao.setAddressConfiguration(SignerAddressConfig, signerAddress); } @@ -203,9 +203,10 @@ contract Manager is Reimbursable, AdapterGuard, Signatures { * @notice If the extension is already registered, it removes the extension from the DAO Registry. * @notice If the adapterOrExtensionAddr is provided, the new address is added as a new extension to the DAO Registry. */ - function _replaceExtension(DaoRegistry dao, ProposalDetails memory proposal) - internal - { + function _replaceExtension( + DaoRegistry dao, + ProposalDetails memory proposal + ) internal { if (dao.extensions(proposal.adapterOrExtensionId) != address(0x0)) { dao.removeExtension(proposal.adapterOrExtensionId); } @@ -282,11 +283,10 @@ contract Manager is Reimbursable, AdapterGuard, Signatures { * @param dao is the DAO instance to be configured * @param coupon is the coupon to hash */ - function hashCouponMessage(DaoRegistry dao, ManagingCoupon memory coupon) - public - view - returns (bytes32) - { + function hashCouponMessage( + DaoRegistry dao, + ManagingCoupon memory coupon + ) public view returns (bytes32) { bytes32 message = keccak256( abi.encode( MANAGING_COUPON_MESSAGE_TYPEHASH, @@ -300,11 +300,9 @@ contract Manager is Reimbursable, AdapterGuard, Signatures { return hashMessage(dao, address(this), message); } - function hashProposal(ProposalDetails memory proposal) - public - pure - returns (bytes32) - { + function hashProposal( + ProposalDetails memory proposal + ) public pure returns (bytes32) { return keccak256( abi.encode( @@ -321,11 +319,9 @@ contract Manager is Reimbursable, AdapterGuard, Signatures { ); } - function hashConfigurations(Configuration[] memory configs) - public - pure - returns (bytes32) - { + function hashConfigurations( + Configuration[] memory configs + ) public pure returns (bytes32) { bytes32[] memory result = new bytes32[](configs.length); for (uint256 i = 0; i < configs.length; i++) { result[i] = keccak256( diff --git a/contracts/adapters/Managing.sol b/contracts/adapters/Managing.sol index 60373ce89..3ac7e0e66 100644 --- a/contracts/adapters/Managing.sol +++ b/contracts/adapters/Managing.sol @@ -118,11 +118,10 @@ contract ManagingContract is IManaging, AdapterGuard, Reimbursable { * @param proposalId The proposal id. */ // slither-disable-next-line reentrancy-benign - function processProposal(DaoRegistry dao, bytes32 proposalId) - external - override - reimbursable(dao) - { + function processProposal( + DaoRegistry dao, + bytes32 proposalId + ) external override reimbursable(dao) { ProposalDetails memory proposal = proposals[address(dao)][proposalId]; IVoting votingContract = IVoting(dao.votingAdapter(proposalId)); @@ -156,9 +155,10 @@ contract ManagingContract is IManaging, AdapterGuard, Reimbursable { * @notice If the extension is already registered, it removes the extension from the DAO Registry. * @notice If the adapterOrExtensionAddr is provided, the new address is added as a new extension to the DAO Registry. */ - function _replaceExtension(DaoRegistry dao, ProposalDetails memory proposal) - internal - { + function _replaceExtension( + DaoRegistry dao, + ProposalDetails memory proposal + ) internal { if (dao.extensions(proposal.adapterOrExtensionId) != address(0x0)) { dao.removeExtension(proposal.adapterOrExtensionId); } @@ -197,9 +197,10 @@ contract ManagingContract is IManaging, AdapterGuard, Reimbursable { /** * @notice Saves the numeric/address configurations to the DAO registry */ - function _saveDaoConfigurations(DaoRegistry dao, bytes32 proposalId) - internal - { + function _saveDaoConfigurations( + DaoRegistry dao, + bytes32 proposalId + ) internal { Configuration[] memory configs = configurations[address(dao)][ proposalId ]; diff --git a/contracts/adapters/Onboarding.sol b/contracts/adapters/Onboarding.sol index 41bada2b7..d3b2698e1 100644 --- a/contracts/adapters/Onboarding.sol +++ b/contracts/adapters/Onboarding.sol @@ -175,12 +175,10 @@ contract OnboardingContract is IOnboarding, AdapterGuard, Reimbursable { * @param proposalId The proposal id to be processed. It needs to exist in the DAO Registry. */ // slither-disable-next-line reentrancy-benign - function processProposal(DaoRegistry dao, bytes32 proposalId) - external - payable - override - reimbursable(dao) - { + function processProposal( + DaoRegistry dao, + bytes32 proposalId + ) external payable override reimbursable(dao) { ProposalDetails storage proposal = proposals[dao][proposalId]; require(proposal.id == proposalId, "proposal does not exist"); require( @@ -352,11 +350,10 @@ contract OnboardingContract is IOnboarding, AdapterGuard, Reimbursable { * @param tokenAddrToMint The address to encode. * @param key The key to encode. */ - function _configKey(address tokenAddrToMint, bytes32 key) - internal - pure - returns (bytes32) - { + function _configKey( + address tokenAddrToMint, + bytes32 key + ) internal pure returns (bytes32) { return keccak256(abi.encode(tokenAddrToMint, key)); } } diff --git a/contracts/adapters/Signatures.sol b/contracts/adapters/Signatures.sol index 273b7fe80..56e5e4a90 100644 --- a/contracts/adapters/Signatures.sol +++ b/contracts/adapters/Signatures.sol @@ -92,11 +92,10 @@ contract SignaturesContract is ISignatures, AdapterGuard, Reimbursable { * @param dao The DAO Address. * @param proposalId The proposal id. */ - function processProposal(DaoRegistry dao, bytes32 proposalId) - external - override - reimbursable(dao) - { + function processProposal( + DaoRegistry dao, + bytes32 proposalId + ) external override reimbursable(dao) { ProposalDetails memory details = proposals[address(dao)][proposalId]; IVoting votingContract = IVoting(dao.votingAdapter(proposalId)); diff --git a/contracts/adapters/Tribute.sol b/contracts/adapters/Tribute.sol index 5e9810890..6c488718b 100644 --- a/contracts/adapters/Tribute.sol +++ b/contracts/adapters/Tribute.sol @@ -70,10 +70,10 @@ contract TributeContract is Reimbursable, AdapterGuard { * @param dao The DAO address. * @param tokenAddrToMint The internal token address to be registered with the DAO Bank. */ - function configureDao(DaoRegistry dao, address tokenAddrToMint) - external - onlyAdapter(dao) - { + function configureDao( + DaoRegistry dao, + address tokenAddrToMint + ) external onlyAdapter(dao) { BankExtension bank = BankExtension( dao.getExtensionAddress(DaoHelper.BANK) ); @@ -152,10 +152,10 @@ contract TributeContract is Reimbursable, AdapterGuard { * @param dao The DAO address. * @param proposalId The proposal id. */ - function processProposal(DaoRegistry dao, bytes32 proposalId) - external - reimbursable(dao) - { + function processProposal( + DaoRegistry dao, + bytes32 proposalId + ) external reimbursable(dao) { ProposalDetails memory proposal = proposals[address(dao)][proposalId]; require(proposal.id == proposalId, "proposal does not exist"); require( diff --git a/contracts/adapters/TributeNFT.sol b/contracts/adapters/TributeNFT.sol index c1bca3879..2ca8cea44 100644 --- a/contracts/adapters/TributeNFT.sol +++ b/contracts/adapters/TributeNFT.sol @@ -78,10 +78,10 @@ contract TributeNFTContract is * @dev A DAO Bank extension must exist and be configured with proper access for this adapter. * @param dao The DAO address. */ - function configureDao(DaoRegistry dao, address tokenAddrToMint) - external - onlyAdapter(dao) - { + function configureDao( + DaoRegistry dao, + address tokenAddrToMint + ) external onlyAdapter(dao) { BankExtension(dao.getExtensionAddress(DaoHelper.BANK)) .registerPotentialNewInternalToken(dao, tokenAddrToMint); } @@ -140,7 +140,10 @@ contract TributeNFTContract is ); } - function _processProposal(DaoRegistry dao, bytes32 proposalId) + function _processProposal( + DaoRegistry dao, + bytes32 proposalId + ) internal returns ( ProposalDetails storage proposal, @@ -256,12 +259,9 @@ contract TributeNFTContract is * @notice Supports ERC-165 & ERC-1155 interfaces only. * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1155.md */ - function supportsInterface(bytes4 interfaceID) - external - pure - override - returns (bool) - { + function supportsInterface( + bytes4 interfaceID + ) external pure override returns (bool) { return interfaceID == this.supportsInterface.selector || interfaceID == this.onERC1155Received.selector || @@ -314,10 +314,10 @@ contract TributeNFTContract is * @param dao The DAO address. * @param proposalId The proposalId to be processed. */ - function processERC721Proposal(DaoRegistry dao, bytes32 proposalId) - external - reimbursable(dao) - { + function processERC721Proposal( + DaoRegistry dao, + bytes32 proposalId + ) external reimbursable(dao) { ( ProposalDetails storage proposal, IVoting.VotingState voteResult diff --git a/contracts/adapters/interfaces/IOnboarding.sol b/contracts/adapters/interfaces/IOnboarding.sol index 96cc0be1a..1f84391af 100644 --- a/contracts/adapters/interfaces/IOnboarding.sol +++ b/contracts/adapters/interfaces/IOnboarding.sol @@ -38,7 +38,8 @@ interface IOnboarding { bytes memory data ) external; - function processProposal(DaoRegistry dao, bytes32 proposalId) - external - payable; + function processProposal( + DaoRegistry dao, + bytes32 proposalId + ) external payable; } diff --git a/contracts/adapters/interfaces/IVoting.sol b/contracts/adapters/interfaces/IVoting.sol index 5cca698d4..6cd3d45f9 100644 --- a/contracts/adapters/interfaces/IVoting.sol +++ b/contracts/adapters/interfaces/IVoting.sol @@ -53,7 +53,8 @@ interface IVoting { address sender ) external returns (address); - function voteResult(DaoRegistry dao, bytes32 proposalId) - external - returns (VotingState state); + function voteResult( + DaoRegistry dao, + bytes32 proposalId + ) external returns (VotingState state); } diff --git a/contracts/adapters/modifiers/ReimbursableLib.sol b/contracts/adapters/modifiers/ReimbursableLib.sol index f1c592b8b..1ae1c9cda 100644 --- a/contracts/adapters/modifiers/ReimbursableLib.sol +++ b/contracts/adapters/modifiers/ReimbursableLib.sol @@ -30,10 +30,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ library ReimbursableLib { - function beforeExecution(DaoRegistry dao) - internal - returns (Reimbursable.ReimbursementData memory data) - { + function beforeExecution( + DaoRegistry dao + ) internal returns (Reimbursable.ReimbursementData memory data) { data.gasStart = gasleft(); require(dao.lockedAt() != block.number, "reentrancy guard"); dao.lockSession(); diff --git a/contracts/adapters/voting/KickBadReporterAdapter.sol b/contracts/adapters/voting/KickBadReporterAdapter.sol index fe5b9b67c..7e69f95d3 100644 --- a/contracts/adapters/voting/KickBadReporterAdapter.sol +++ b/contracts/adapters/voting/KickBadReporterAdapter.sol @@ -83,11 +83,9 @@ contract KickBadReporterAdapter is MemberGuard { } } - function _getVotingContract(DaoRegistry dao) - internal - view - returns (OffchainVotingContract) - { + function _getVotingContract( + DaoRegistry dao + ) internal view returns (OffchainVotingContract) { address addr = dao.getAdapterAddress(DaoHelper.VOTING); return OffchainVotingContract(payable(addr)); } diff --git a/contracts/adapters/voting/OffchainVoting.sol b/contracts/adapters/voting/OffchainVoting.sol index 969e40c2e..2d61069b8 100644 --- a/contracts/adapters/voting/OffchainVoting.sol +++ b/contracts/adapters/voting/OffchainVoting.sol @@ -160,11 +160,10 @@ contract OffchainVotingContract is dao.setConfiguration(FallbackThreshold, fallbackThreshold); } - function getVote(DaoRegistry dao, bytes32 proposalId) - external - view - returns (VotingDetails memory) - { + function getVote( + DaoRegistry dao, + bytes32 proposalId + ) external view returns (VotingDetails memory) { Voting storage vote = votes[address(dao)][proposalId]; return @@ -189,11 +188,10 @@ contract OffchainVotingContract is * @param proposalId The proposal id to mark as failed */ // slither-disable-next-line reentrancy-benign - function adminFailProposal(DaoRegistry dao, bytes32 proposalId) - external - onlyOwner - reentrancyGuard(dao) - { + function adminFailProposal( + DaoRegistry dao, + bytes32 proposalId + ) external onlyOwner reentrancyGuard(dao) { Voting storage vote = votes[address(dao)][proposalId]; require(vote.startingTime > 0, "proposal has not started yet"); @@ -204,11 +202,10 @@ contract OffchainVotingContract is return ADAPTER_NAME; } - function getChallengeDetails(DaoRegistry dao, bytes32 proposalId) - external - view - returns (uint256, address) - { + function getChallengeDetails( + DaoRegistry dao, + bytes32 proposalId + ) external view returns (uint256, address) { return ( challengeProposals[address(dao)][proposalId].units, challengeProposals[address(dao)][proposalId].reporter @@ -240,12 +237,10 @@ contract OffchainVotingContract is * 3: not pass * 4: in progress */ - function voteResult(DaoRegistry dao, bytes32 proposalId) - public - view - override - returns (VotingState state) - { + function voteResult( + DaoRegistry dao, + bytes32 proposalId + ) public view override returns (VotingState state) { Voting storage vote = votes[address(dao)][proposalId]; if (_ovHelper.isFallbackVotingActivated(dao, vote.fallbackVotesCount)) { return fallbackVoting.voteResult(dao, proposalId); @@ -466,10 +461,10 @@ contract OffchainVotingContract is * @param proposalId The proposal id associated with the missing step */ // slither-disable-next-line reentrancy-benign,reentrancy-events - function challengeMissingStep(DaoRegistry dao, bytes32 proposalId) - external - reimbursable(dao) - { + function challengeMissingStep( + DaoRegistry dao, + bytes32 proposalId + ) external reimbursable(dao) { Voting storage vote = votes[address(dao)][proposalId]; uint256 gracePeriod = dao.getConfiguration(GracePeriod); //if the vote has started but the voting period has not passed yet, it's in progress @@ -606,11 +601,10 @@ contract OffchainVotingContract is * @param proposalId The proposalId that will used in the fallback voting contract */ // slither-disable-next-line reentrancy-benign - function requestFallback(DaoRegistry dao, bytes32 proposalId) - external - reentrancyGuard(dao) - onlyMember(dao) - { + function requestFallback( + DaoRegistry dao, + bytes32 proposalId + ) external reentrancyGuard(dao) onlyMember(dao) { VotingState state = voteResult(dao, proposalId); require( state != VotingState.PASS && @@ -690,11 +684,10 @@ contract OffchainVotingContract is dao.sponsorProposal(proposalId, sponsoredBy, address(this)); } - function processChallengeProposal(DaoRegistry dao, bytes32 proposalId) - external - reentrancyGuard(dao) - onlyBadReporterAdapter - { + function processChallengeProposal( + DaoRegistry dao, + bytes32 proposalId + ) external reentrancyGuard(dao) onlyBadReporterAdapter { dao.processProposal(proposalId); } diff --git a/contracts/adapters/voting/OffchainVotingHash.sol b/contracts/adapters/voting/OffchainVotingHash.sol index 169b1ebf2..262451539 100644 --- a/contracts/adapters/voting/OffchainVotingHash.sol +++ b/contracts/adapters/voting/OffchainVotingHash.sol @@ -94,11 +94,9 @@ contract OffchainVotingHashContract { ); } - function hashVotingResultNode(VoteResultNode memory node) - public - pure - returns (bytes32) - { + function hashVotingResultNode( + VoteResultNode memory node + ) public pure returns (bytes32) { return keccak256( abi.encode( @@ -149,11 +147,9 @@ contract OffchainVotingHashContract { return SignatureChecker.isValidSignatureNow(voter, voteHash, sig); } - function stringToUint(string memory s) - external - pure - returns (bool success, uint256 result) - { + function stringToUint( + string memory s + ) external pure returns (bool success, uint256 result) { bytes memory b = bytes(s); result = 0; success = false; diff --git a/contracts/adapters/voting/SnapshotProposalContract.sol b/contracts/adapters/voting/SnapshotProposalContract.sol index be5a73646..5c59837e3 100644 --- a/contracts/adapters/voting/SnapshotProposalContract.sol +++ b/contracts/adapters/voting/SnapshotProposalContract.sol @@ -83,11 +83,10 @@ contract SnapshotProposalContract { bytes32 proposalId; } - function DOMAIN_SEPARATOR(DaoRegistry dao, address actionId) - public - view - returns (bytes32) - { + function DOMAIN_SEPARATOR( + DaoRegistry dao, + address actionId + ) public view returns (bytes32) { return keccak256( abi.encode( @@ -116,11 +115,9 @@ contract SnapshotProposalContract { ); } - function hashProposalMessage(ProposalMessage memory message) - public - pure - returns (bytes32) - { + function hashProposalMessage( + ProposalMessage memory message + ) public pure returns (bytes32) { return keccak256( abi.encode( @@ -132,11 +129,9 @@ contract SnapshotProposalContract { ); } - function hashProposalPayload(ProposalPayload memory payload) - public - pure - returns (bytes32) - { + function hashProposalPayload( + ProposalPayload memory payload + ) public pure returns (bytes32) { return keccak256( abi.encode( @@ -166,11 +161,9 @@ contract SnapshotProposalContract { ); } - function hashVoteInternal(VoteMessage memory message) - public - pure - returns (bytes32) - { + function hashVoteInternal( + VoteMessage memory message + ) public pure returns (bytes32) { return keccak256( abi.encode( @@ -181,11 +174,9 @@ contract SnapshotProposalContract { ); } - function hashVotePayload(VotePayload memory payload) - public - pure - returns (bytes32) - { + function hashVotePayload( + VotePayload memory payload + ) public pure returns (bytes32) { return keccak256( abi.encode( @@ -196,11 +187,9 @@ contract SnapshotProposalContract { ); } - function toHashArray(string[] memory arr) - internal - pure - returns (bytes32[] memory result) - { + function toHashArray( + string[] memory arr + ) internal pure returns (bytes32[] memory result) { result = new bytes32[](arr.length); for (uint256 i = 0; i < arr.length; i++) { result[i] = keccak256(abi.encodePacked(arr[i])); diff --git a/contracts/adapters/voting/Voting.sol b/contracts/adapters/voting/Voting.sol index 2f7170f4a..d2dbb0137 100644 --- a/contracts/adapters/voting/Voting.sol +++ b/contracts/adapters/voting/Voting.sol @@ -180,12 +180,10 @@ contract VotingContract is IVoting, MemberGuard, AdapterGuard, Reimbursable { * 3: not pass * 4: in progress */ - function voteResult(DaoRegistry dao, bytes32 proposalId) - external - view - override - returns (VotingState state) - { + function voteResult( + DaoRegistry dao, + bytes32 proposalId + ) external view override returns (VotingState state) { Voting storage vote = votes[address(dao)][proposalId]; if (vote.startingTime == 0) { return VotingState.NOT_STARTED; diff --git a/contracts/companion/GelatoBytes.sol b/contracts/companion/GelatoBytes.sol index 192b963b3..83ecf2950 100644 --- a/contracts/companion/GelatoBytes.sol +++ b/contracts/companion/GelatoBytes.sol @@ -3,11 +3,9 @@ pragma solidity ^0.8.0; library GelatoBytes { - function calldataSliceSelector(bytes calldata _bytes) - internal - pure - returns (bytes4 selector) - { + function calldataSliceSelector( + bytes calldata _bytes + ) internal pure returns (bytes4 selector) { selector = _bytes[0] | (bytes4(_bytes[1]) >> 8) | @@ -15,11 +13,9 @@ library GelatoBytes { (bytes4(_bytes[3]) >> 24); } - function memorySliceSelector(bytes memory _bytes) - internal - pure - returns (bytes4 selector) - { + function memorySliceSelector( + bytes memory _bytes + ) internal pure returns (bytes4 selector) { selector = _bytes[0] | (bytes4(_bytes[1]) >> 8) | @@ -27,10 +23,10 @@ library GelatoBytes { (bytes4(_bytes[3]) >> 24); } - function revertWithError(bytes memory _bytes, string memory _tracingInfo) - internal - pure - { + function revertWithError( + bytes memory _bytes, + string memory _tracingInfo + ) internal pure { // 68: 32-location, 32-length, 4-ErrorSelector, UTF-8 err if (_bytes.length % 32 == 4) { bytes4 selector; @@ -55,11 +51,10 @@ library GelatoBytes { } } - function returnError(bytes memory _bytes, string memory _tracingInfo) - internal - pure - returns (string memory) - { + function returnError( + bytes memory _bytes, + string memory _tracingInfo + ) internal pure returns (string memory) { // 68: 32-location, 32-length, 4-ErrorSelector, UTF-8 err if (_bytes.length % 32 == 4) { bytes4 selector; diff --git a/contracts/companion/Reimbursement.sol b/contracts/companion/Reimbursement.sol index 0b766cd92..dfde234a7 100644 --- a/contracts/companion/Reimbursement.sol +++ b/contracts/companion/Reimbursement.sol @@ -85,12 +85,10 @@ contract ReimbursementContract is IReimbursement, AdapterGuard, GelatoRelay { * @param dao the dao that should reimburse * @param gasLeft the maximum gas usable in this transaction */ - function shouldReimburse(DaoRegistry dao, uint256 gasLeft) - external - view - override - returns (bool, uint256) - { + function shouldReimburse( + DaoRegistry dao, + uint256 gasLeft + ) external view override returns (bool, uint256) { //if it is a gelato call, do nothing as it will be handled somewhere else if (msg.sender == address(this)) { return (false, 0); diff --git a/contracts/companion/interfaces/IReimbursement.sol b/contracts/companion/interfaces/IReimbursement.sol index 393dc525e..2ab8d1c3a 100644 --- a/contracts/companion/interfaces/IReimbursement.sol +++ b/contracts/companion/interfaces/IReimbursement.sol @@ -36,8 +36,8 @@ interface IReimbursement { uint256 spendLimitPeriod ) external; - function shouldReimburse(DaoRegistry dao, uint256 gasLeft) - external - view - returns (bool, uint256); + function shouldReimburse( + DaoRegistry dao, + uint256 gasLeft + ) external view returns (bool, uint256); } diff --git a/contracts/core/CloneFactory.sol b/contracts/core/CloneFactory.sol index 41ba87863..37f6ab630 100644 --- a/contracts/core/CloneFactory.sol +++ b/contracts/core/CloneFactory.sol @@ -26,10 +26,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. //solhint-disable no-inline-assembly contract CloneFactory { - function _createClone(address target) - internal - returns (address payable result) - { + function _createClone( + address target + ) internal returns (address payable result) { bytes20 targetBytes = bytes20(target); assembly { let clone := mload(0x40) @@ -47,11 +46,10 @@ contract CloneFactory { require(result != address(0), "create failed"); } - function _isClone(address target, address query) - internal - view - returns (bool result) - { + function _isClone( + address target, + address query + ) internal view returns (bool result) { bytes20 targetBytes = bytes20(target); assembly { let clone := mload(0x40) diff --git a/contracts/core/DaoFactory.sol b/contracts/core/DaoFactory.sol index b3674bd15..578aaf3b8 100644 --- a/contracts/core/DaoFactory.sol +++ b/contracts/core/DaoFactory.sol @@ -83,11 +83,9 @@ contract DaoFactory is CloneFactory { * @return The address of a DAO, given its name. * @param daoName Name of the DAO to be searched. */ - function getDaoAddress(string calldata daoName) - external - view - returns (address) - { + function getDaoAddress( + string calldata daoName + ) external view returns (address) { return addresses[keccak256(abi.encode(daoName))]; } @@ -99,9 +97,10 @@ contract DaoFactory is CloneFactory { * @param dao DaoRegistry to have adapters added to. * @param adapters Adapter structs to be added to the DAO. */ - function addAdapters(DaoRegistry dao, Adapter[] calldata adapters) - external - { + function addAdapters( + DaoRegistry dao, + Adapter[] calldata adapters + ) external { require(dao.isMember(msg.sender), "not member"); //Registring Adapters require( diff --git a/contracts/core/DaoRegistry.sol b/contracts/core/DaoRegistry.sol index 5e0b94e0a..d3f6785ab 100644 --- a/contracts/core/DaoRegistry.sol +++ b/contracts/core/DaoRegistry.sol @@ -227,10 +227,10 @@ contract DaoRegistry is MemberGuard, AdapterGuard { * @param key The configuration key for which the value will be set * @param value The value to set the key */ - function setConfiguration(bytes32 key, uint256 value) - external - hasAccess(this, AclFlag.SET_CONFIGURATION) - { + function setConfiguration( + bytes32 key, + uint256 value + ) external hasAccess(this, AclFlag.SET_CONFIGURATION) { mainConfiguration[key] = value; emit ConfigurationUpdated(key, value); @@ -242,10 +242,10 @@ contract DaoRegistry is MemberGuard, AdapterGuard { * @param key The configuration key for which the value will be set * @param value The value to set the key */ - function setAddressConfiguration(bytes32 key, address value) - external - hasAccess(this, AclFlag.SET_CONFIGURATION) - { + function setAddressConfiguration( + bytes32 key, + address value + ) external hasAccess(this, AclFlag.SET_CONFIGURATION) { addressConfiguration[key] = value; emit AddressConfigurationUpdated(key, value); @@ -263,11 +263,9 @@ contract DaoRegistry is MemberGuard, AdapterGuard { * @return The configuration value of a particular key * @param key The key to look up in the configuration mapping */ - function getAddressConfiguration(bytes32 key) - external - view - returns (address) - { + function getAddressConfiguration( + bytes32 key + ) external view returns (address) { return addressConfiguration[key]; } @@ -336,11 +334,10 @@ contract DaoRegistry is MemberGuard, AdapterGuard { * @param adapterAddress The address to look up * @param flag The ACL flag to check against the given address */ - function hasAdapterAccess(address adapterAddress, AclFlag flag) - external - view - returns (bool) - { + function hasAdapterAccess( + address adapterAddress, + AclFlag flag + ) external view returns (bool) { return DaoHelper.getFlag(inverseAdapters[adapterAddress].acl, uint8(flag)); } @@ -349,11 +346,9 @@ contract DaoRegistry is MemberGuard, AdapterGuard { * @return The address of a given adapter ID * @param adapterId The ID to look up */ - function getAdapterAddress(bytes32 adapterId) - external - view - returns (address) - { + function getAdapterAddress( + bytes32 adapterId + ) external view returns (address) { require(adapters[adapterId] != address(0), "adapter not found"); return adapters[adapterId]; } @@ -368,10 +363,10 @@ contract DaoRegistry is MemberGuard, AdapterGuard { * @param extension The address of the extension */ // slither-disable-next-line reentrancy-events - function addExtension(bytes32 extensionId, IExtension extension) - external - hasAccess(this, AclFlag.ADD_EXTENSION) - { + function addExtension( + bytes32 extensionId, + IExtension extension + ) external hasAccess(this, AclFlag.ADD_EXTENSION) { require(extensionId != bytes32(0), "extension id must not be empty"); require( extensions[extensionId] == address(0x0), @@ -387,11 +382,7 @@ contract DaoRegistry is MemberGuard, AdapterGuard { } // v1.0.6 signature - function addExtension( - bytes32, - IExtension, - address - ) external { + function addExtension(bytes32, IExtension, address) external { revert("not implemented"); } @@ -399,10 +390,9 @@ contract DaoRegistry is MemberGuard, AdapterGuard { * @notice Removes an adapter from the registry * @param extensionId The unique identifier of the extension */ - function removeExtension(bytes32 extensionId) - external - hasAccess(this, AclFlag.REMOVE_EXTENSION) - { + function removeExtension( + bytes32 extensionId + ) external hasAccess(this, AclFlag.REMOVE_EXTENSION) { require(extensionId != bytes32(0), "extensionId must not be empty"); address extensionAddress = extensions[extensionId]; require(extensionAddress != address(0x0), "extensionId not registered"); @@ -458,11 +448,9 @@ contract DaoRegistry is MemberGuard, AdapterGuard { * @return The address of a given extension Id * @param extensionId The ID to look up */ - function getExtensionAddress(bytes32 extensionId) - external - view - returns (address) - { + function getExtensionAddress( + bytes32 extensionId + ) external view returns (address) { require(extensions[extensionId] != address(0), "extension not found"); return extensions[extensionId]; } @@ -474,10 +462,9 @@ contract DaoRegistry is MemberGuard, AdapterGuard { /** * @notice Submit proposals to the DAO registry */ - function submitProposal(bytes32 proposalId) - external - hasAccess(this, AclFlag.SUBMIT_PROPOSAL) - { + function submitProposal( + bytes32 proposalId + ) external hasAccess(this, AclFlag.SUBMIT_PROPOSAL) { require(proposalId != bytes32(0), "invalid proposalId"); require( !getProposalFlag(proposalId, ProposalFlag.EXISTS), @@ -541,10 +528,10 @@ contract DaoRegistry is MemberGuard, AdapterGuard { * @param proposalId The ID of the proposal to be changed * @param flag The flag that will be set on the proposal */ - function _setProposalFlag(bytes32 proposalId, ProposalFlag flag) - internal - returns (Proposal storage) - { + function _setProposalFlag( + bytes32 proposalId, + ProposalFlag flag + ) internal returns (Proposal storage) { Proposal storage proposal = proposals[proposalId]; uint256 flags = proposal.flags; @@ -571,11 +558,10 @@ contract DaoRegistry is MemberGuard, AdapterGuard { * @param proposalId The proposal to check against flag * @param flag The flag to check in the proposal */ - function getProposalFlag(bytes32 proposalId, ProposalFlag flag) - public - view - returns (bool) - { + function getProposalFlag( + bytes32 proposalId, + ProposalFlag flag + ) public view returns (bool) { return DaoHelper.getFlag(proposals[proposalId].flags, uint8(flag)); } @@ -587,10 +573,9 @@ contract DaoRegistry is MemberGuard, AdapterGuard { * @notice Sets true for the JAILED flag. * @param memberAddress The address of the member to update the flag. */ - function jailMember(address memberAddress) - external - hasAccess(this, AclFlag.JAIL_MEMBER) - { + function jailMember( + address memberAddress + ) external hasAccess(this, AclFlag.JAIL_MEMBER) { require(memberAddress != address(0x0), "invalid member address"); Member storage member = members[memberAddress]; @@ -610,10 +595,9 @@ contract DaoRegistry is MemberGuard, AdapterGuard { * @notice Sets false for the JAILED flag. * @param memberAddress The address of the member to update the flag. */ - function unjailMember(address memberAddress) - external - hasAccess(this, AclFlag.JAIL_MEMBER) - { + function unjailMember( + address memberAddress + ) external hasAccess(this, AclFlag.JAIL_MEMBER) { require(memberAddress != address(0x0), "invalid member address"); Member storage member = members[memberAddress]; @@ -645,10 +629,9 @@ contract DaoRegistry is MemberGuard, AdapterGuard { * @notice Registers a member address in the DAO if it is not registered or invalid. * @notice A potential new member is a member that holds no shares, and its registration still needs to be voted on. */ - function potentialNewMember(address memberAddress) - public - hasAccess(this, AclFlag.NEW_MEMBER) - { + function potentialNewMember( + address memberAddress + ) public hasAccess(this, AclFlag.NEW_MEMBER) { require(memberAddress != address(0x0), "invalid member address"); Member storage member = members[memberAddress]; @@ -695,11 +678,10 @@ contract DaoRegistry is MemberGuard, AdapterGuard { * @param memberAddress The member to check against flag * @param flag The flag to check in the member */ - function getMemberFlag(address memberAddress, MemberFlag flag) - public - view - returns (bool) - { + function getMemberFlag( + address memberAddress, + MemberFlag flag + ) public view returns (bool) { return DaoHelper.getFlag(members[memberAddress].flags, uint8(flag)); } @@ -726,10 +708,10 @@ contract DaoRegistry is MemberGuard, AdapterGuard { * @param memberAddr The member doing the delegation * @param newDelegateKey The member who is being delegated to */ - function updateDelegateKey(address memberAddr, address newDelegateKey) - external - hasAccess(this, AclFlag.UPDATE_DELEGATE_KEY) - { + function updateDelegateKey( + address memberAddr, + address newDelegateKey + ) external hasAccess(this, AclFlag.UPDATE_DELEGATE_KEY) { require(newDelegateKey != address(0x0), "newDelegateKey cannot be 0"); // skip checks if member is setting the delegate key to their member address @@ -767,11 +749,9 @@ contract DaoRegistry is MemberGuard, AdapterGuard { * @param checkAddr The address to check for a delegate * @return the delegated address or the checked address if it is not a delegate */ - function getAddressIfDelegated(address checkAddr) - external - view - returns (address) - { + function getAddressIfDelegated( + address checkAddr + ) external view returns (address) { address delegatedKey = memberAddressesByDelegatedKey[checkAddr]; return delegatedKey == address(0x0) ? checkAddr : delegatedKey; } @@ -780,11 +760,9 @@ contract DaoRegistry is MemberGuard, AdapterGuard { * @param memberAddr The member whose delegate will be returned * @return the delegate key at the current time for a member */ - function getCurrentDelegateKey(address memberAddr) - public - view - returns (address) - { + function getCurrentDelegateKey( + address memberAddr + ) public view returns (address) { uint32 nCheckpoints = _numCheckpoints[memberAddr]; return nCheckpoints > 0 @@ -796,11 +774,9 @@ contract DaoRegistry is MemberGuard, AdapterGuard { * @param memberAddr The member address to look up * @return The delegate key address for memberAddr at the second last checkpoint number */ - function getPreviousDelegateKey(address memberAddr) - external - view - returns (address) - { + function getPreviousDelegateKey( + address memberAddr + ) external view returns (address) { uint32 nCheckpoints = _numCheckpoints[memberAddr]; return nCheckpoints > 1 @@ -815,11 +791,10 @@ contract DaoRegistry is MemberGuard, AdapterGuard { * @param blockNumber The block number to get the vote balance at * @return The delegate key of the member */ - function getPriorDelegateKey(address memberAddr, uint256 blockNumber) - external - view - returns (address) - { + function getPriorDelegateKey( + address memberAddr, + uint256 blockNumber + ) external view returns (address) { require(blockNumber < block.number, "getPriorDelegateKey: NYD"); uint32 nCheckpoints = _numCheckpoints[memberAddr]; diff --git a/contracts/extensions/bank/Bank.sol b/contracts/extensions/bank/Bank.sol index 29a884aad..b0f79ceba 100644 --- a/contracts/extensions/bank/Bank.sol +++ b/contracts/extensions/bank/Bank.sol @@ -225,10 +225,10 @@ contract BankExtension is IExtension, ERC165 { * @dev Cannot be a reserved token or an available internal token * @param token The address of the token */ - function registerPotentialNewToken(DaoRegistry _dao, address token) - external - hasExtensionAccess(_dao, AclFlag.REGISTER_NEW_TOKEN) - { + function registerPotentialNewToken( + DaoRegistry _dao, + address token + ) external hasExtensionAccess(_dao, AclFlag.REGISTER_NEW_TOKEN) { require(DaoHelper.isNotReservedAddress(token), "reservedToken"); require(!availableInternalTokens[token], "internalToken"); require( @@ -247,10 +247,10 @@ contract BankExtension is IExtension, ERC165 { * @dev Can not be a reserved token or an available token * @param token The address of the token */ - function registerPotentialNewInternalToken(DaoRegistry _dao, address token) - external - hasExtensionAccess(_dao, AclFlag.REGISTER_NEW_INTERNAL_TOKEN) - { + function registerPotentialNewInternalToken( + DaoRegistry _dao, + address token + ) external hasExtensionAccess(_dao, AclFlag.REGISTER_NEW_INTERNAL_TOKEN) { require(DaoHelper.isNotReservedAddress(token), "reservedToken"); require(!availableTokens[token], "availableToken"); @@ -260,10 +260,10 @@ contract BankExtension is IExtension, ERC165 { } } - function updateToken(DaoRegistry _dao, address tokenAddr) - external - hasExtensionAccess(_dao, AclFlag.UPDATE_TOKEN) - { + function updateToken( + DaoRegistry _dao, + address tokenAddr + ) external hasExtensionAccess(_dao, AclFlag.UPDATE_TOKEN) { require(isTokenAllowed(tokenAddr), "token not allowed"); uint256 totalBalance = balanceOf(DaoHelper.TOTAL, tokenAddr); @@ -349,11 +349,7 @@ contract BankExtension is IExtension, ERC165 { return internalTokens.length; } - function addToBalance( - address, - address, - uint256 - ) external payable { + function addToBalance(address, address, uint256) external payable { revert("not implemented"); } @@ -399,20 +395,11 @@ contract BankExtension is IExtension, ERC165 { _createNewAmountCheckpoint(DaoHelper.TOTAL, token, newTotalAmount); } - function subtractFromBalance( - address, - address, - uint256 - ) external { + function subtractFromBalance(address, address, uint256) external { revert("not implemented"); } - function internalTransfer( - address, - address, - address, - uint256 - ) external { + function internalTransfer(address, address, address, uint256) external { revert("not implemented"); } @@ -444,11 +431,10 @@ contract BankExtension is IExtension, ERC165 { * @param tokenAddr The token where the member's balance of which will be returned * @return The amount in account's tokenAddr balance */ - function balanceOf(address member, address tokenAddr) - public - view - returns (uint160) - { + function balanceOf( + address member, + address tokenAddr + ) public view returns (uint160) { uint32 nCheckpoints = numCheckpoints[tokenAddr][member]; return nCheckpoints > 0 @@ -507,13 +493,9 @@ contract BankExtension is IExtension, ERC165 { return checkpoints[tokenAddr][account][lower].amount; } - function supportsInterface(bytes4 interfaceId) - public - view - virtual - override - returns (bool) - { + function supportsInterface( + bytes4 interfaceId + ) public view virtual override returns (bool) { return super.supportsInterface(interfaceId) || this.withdrawTo.selector == interfaceId; diff --git a/contracts/extensions/bank/BankFactory.sol b/contracts/extensions/bank/BankFactory.sol index f91c75ab9..044418695 100644 --- a/contracts/extensions/bank/BankFactory.sol +++ b/contracts/extensions/bank/BankFactory.sol @@ -53,10 +53,10 @@ contract BankFactory is IFactory, CloneFactory, ReentrancyGuard { * @param maxExternalTokens The maximum number of external tokens stored in the Bank */ // slither-disable-next-line reentrancy-events - function create(DaoRegistry dao, uint8 maxExternalTokens) - external - nonReentrant - { + function create( + DaoRegistry dao, + uint8 maxExternalTokens + ) external nonReentrant { address daoAddress = address(dao); require(daoAddress != address(0x0), "invalid dao addr"); address extensionAddr = _createClone(identityAddress); @@ -76,12 +76,9 @@ contract BankFactory is IFactory, CloneFactory, ReentrancyGuard { * because it is prone to front-running attacks. During the extension creation it is safer to * read the new extension address from the event generated in the create call transaction. */ - function getExtensionAddress(address dao) - external - view - override - returns (address) - { + function getExtensionAddress( + address dao + ) external view override returns (address) { return _extensions[dao]; } } diff --git a/contracts/extensions/erc1155/ERC1155TokenExtension.sol b/contracts/extensions/erc1155/ERC1155TokenExtension.sol index 0a50f3e42..c16547b04 100644 --- a/contracts/extensions/erc1155/ERC1155TokenExtension.sol +++ b/contracts/extensions/erc1155/ERC1155TokenExtension.sol @@ -236,11 +236,10 @@ contract ERC1155TokenExtension is IExtension, IERC1155Receiver { * @param nftAddress The NFT address. * @param tokenId The NFT token id. */ - function getNFTId(address nftAddress, uint256 tokenId) - public - pure - returns (bytes32) - { + function getNFTId( + address nftAddress, + uint256 tokenId + ) public pure returns (bytes32) { return keccak256(abi.encodePacked(nftAddress, tokenId)); } @@ -271,11 +270,10 @@ contract ERC1155TokenExtension is IExtension, IERC1155Receiver { * @param tokenAddr The NFT address. * @param index The index to get the token id if it exists. */ - function getNFT(address tokenAddr, uint256 index) - external - view - returns (uint256) - { + function getNFT( + address tokenAddr, + uint256 index + ) external view returns (uint256) { return _nfts[tokenAddr].at(index); } @@ -310,11 +308,10 @@ contract ERC1155TokenExtension is IExtension, IERC1155Receiver { /** * @notice Returns the total number of owners of an NFT addresses and token id collected. */ - function nbNFTOwners(address nftAddress, uint256 tokenId) - external - view - returns (uint256) - { + function nbNFTOwners( + address nftAddress, + uint256 tokenId + ) external view returns (uint256) { return _ownership[getNFTId(nftAddress, tokenId)].length(); } @@ -384,12 +381,9 @@ contract ERC1155TokenExtension is IExtension, IERC1155Receiver { * @notice Supports ERC-165 & ERC-1155 interfaces only. * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1155.md */ - function supportsInterface(bytes4 interfaceID) - external - pure - override - returns (bool) - { + function supportsInterface( + bytes4 interfaceID + ) external pure override returns (bool) { return interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`). interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)")) ^ bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`). diff --git a/contracts/extensions/erc1155/ERC1155TokenExtensionFactory.sol b/contracts/extensions/erc1155/ERC1155TokenExtensionFactory.sol index 65addf2b3..96d39b493 100644 --- a/contracts/extensions/erc1155/ERC1155TokenExtensionFactory.sol +++ b/contracts/extensions/erc1155/ERC1155TokenExtensionFactory.sol @@ -73,12 +73,9 @@ contract ERC1155TokenCollectionFactory is * because it is prone to front-running attacks. During the extension creation it is safer to * read the new extension address from the event generated in the create call transaction. */ - function getExtensionAddress(address dao) - external - view - override - returns (address) - { + function getExtensionAddress( + address dao + ) external view override returns (address) { return _extensions[dao]; } } diff --git a/contracts/extensions/erc1271/ERC1271.sol b/contracts/extensions/erc1271/ERC1271.sol index 81e87a8af..514e127bb 100644 --- a/contracts/extensions/erc1271/ERC1271.sol +++ b/contracts/extensions/erc1271/ERC1271.sol @@ -87,12 +87,10 @@ contract ERC1271Extension is IExtension, IERC1271 { * @param signature The signature in bytes to be encoded, hashed and verified. * @return The magic number in bytes4 in case the signature is valid, otherwise it reverts. */ - function isValidSignature(bytes32 permissionHash, bytes memory signature) - external - view - override - returns (bytes4) - { + function isValidSignature( + bytes32 permissionHash, + bytes memory signature + ) external view override returns (bytes4) { DAOSignature memory daoSignature = signatures[permissionHash]; require(daoSignature.magicValue != 0, "erc1271::invalid signature"); require( diff --git a/contracts/extensions/erc1271/ERC1271Factory.sol b/contracts/extensions/erc1271/ERC1271Factory.sol index 99c775b3b..5ed034957 100644 --- a/contracts/extensions/erc1271/ERC1271Factory.sol +++ b/contracts/extensions/erc1271/ERC1271Factory.sol @@ -68,12 +68,9 @@ contract ERC1271ExtensionFactory is IFactory, CloneFactory, ReentrancyGuard { * because it is prone to front-running attacks. During the extension creation it is safer to * read the new extension address from the event generated in the create call transaction. */ - function getExtensionAddress(address dao) - external - view - override - returns (address) - { + function getExtensionAddress( + address dao + ) external view override returns (address) { return _extensions[dao]; } } diff --git a/contracts/extensions/executor/Executor.sol b/contracts/extensions/executor/Executor.sol index 20d69396e..3c9f94c98 100644 --- a/contracts/extensions/executor/Executor.sol +++ b/contracts/extensions/executor/Executor.sol @@ -83,11 +83,9 @@ contract ExecutorExtension is IExtension { * * This function does not return to its internall call site, it will return directly to the external caller. */ - function _delegate(address implementation) - internal - virtual - hasExtensionAccess(AclFlag.EXECUTE) - { + function _delegate( + address implementation + ) internal virtual hasExtensionAccess(AclFlag.EXECUTE) { require( DaoHelper.isNotZeroAddress(implementation), "executorExt: impl address can not be zero" diff --git a/contracts/extensions/executor/ExecutorFactory.sol b/contracts/extensions/executor/ExecutorFactory.sol index 663ea03a5..63260962f 100644 --- a/contracts/extensions/executor/ExecutorFactory.sol +++ b/contracts/extensions/executor/ExecutorFactory.sol @@ -68,12 +68,9 @@ contract ExecutorExtensionFactory is IFactory, CloneFactory, ReentrancyGuard { * because it is prone to front-running attacks. During the extension creation it is safer to * read the new extension address from the event generated in the create call transaction. */ - function getExtensionAddress(address dao) - external - view - override - returns (address) - { + function getExtensionAddress( + address dao + ) external view override returns (address) { return _extensions[dao]; } } diff --git a/contracts/extensions/nft/NFT.sol b/contracts/extensions/nft/NFT.sol index 122f3a3a3..f70c5d078 100644 --- a/contracts/extensions/nft/NFT.sol +++ b/contracts/extensions/nft/NFT.sol @@ -190,11 +190,10 @@ contract NFTExtension is IExtension, IERC721Receiver { * @param nftAddress The NFT address. * @param tokenId The NFT token id. */ - function getNFTId(address nftAddress, uint256 tokenId) - public - pure - returns (bytes32) - { + function getNFTId( + address nftAddress, + uint256 tokenId + ) public pure returns (bytes32) { return keccak256(abi.encodePacked(nftAddress, tokenId)); } @@ -211,11 +210,10 @@ contract NFTExtension is IExtension, IERC721Receiver { * @param tokenAddr The NFT address. * @param index The index to get the token id if it exists. */ - function getNFT(address tokenAddr, uint256 index) - external - view - returns (uint256) - { + function getNFT( + address tokenAddr, + uint256 index + ) external view returns (uint256) { return _nfts[tokenAddr].at(index); } @@ -239,11 +237,10 @@ contract NFTExtension is IExtension, IERC721Receiver { * @param nftAddress The NFT address. * @param tokenId The NFT token id. */ - function getNFTOwner(address nftAddress, uint256 tokenId) - external - view - returns (address) - { + function getNFTOwner( + address nftAddress, + uint256 tokenId + ) external view returns (address) { return _ownership[getNFTId(nftAddress, tokenId)]; } diff --git a/contracts/extensions/nft/NFTCollectionFactory.sol b/contracts/extensions/nft/NFTCollectionFactory.sol index 24bed9a37..983da62c1 100644 --- a/contracts/extensions/nft/NFTCollectionFactory.sol +++ b/contracts/extensions/nft/NFTCollectionFactory.sol @@ -68,12 +68,9 @@ contract NFTCollectionFactory is IFactory, CloneFactory, ReentrancyGuard { * because it is prone to front-running attacks. During the extension creation it is safer to * read the new extension address from the event generated in the create call transaction. */ - function getExtensionAddress(address dao) - external - view - override - returns (address) - { + function getExtensionAddress( + address dao + ) external view override returns (address) { return _extensions[dao]; } } diff --git a/contracts/extensions/token/erc20/ERC20TokenExtension.sol b/contracts/extensions/token/erc20/ERC20TokenExtension.sol index 3786c4e88..6f9a3e3cd 100644 --- a/contracts/extensions/token/erc20/ERC20TokenExtension.sol +++ b/contracts/extensions/token/erc20/ERC20TokenExtension.sol @@ -165,11 +165,10 @@ contract ERC20Extension is AdapterGuard, IExtension, IERC20 { /** * @dev Returns the amount of tokens owned by `account` considering the snapshot. */ - function getPriorAmount(address account, uint256 snapshot) - external - view - returns (uint256) - { + function getPriorAmount( + address account, + uint256 snapshot + ) external view returns (uint256) { BankExtension bank = BankExtension( dao.getExtensionAddress(DaoHelper.BANK) ); @@ -183,12 +182,10 @@ contract ERC20Extension is AdapterGuard, IExtension, IERC20 { * * This value changes when {approve} or {transferFrom} are called. */ - function allowance(address owner, address spender) - public - view - override - returns (uint256) - { + function allowance( + address owner, + address spender + ) public view override returns (uint256) { return _allowances[owner][spender]; } @@ -201,12 +198,10 @@ contract ERC20Extension is AdapterGuard, IExtension, IERC20 { * Emits an {Approval} event. */ // slither-disable-next-line reentrancy-benign - function approve(address spender, uint256 amount) - public - override - reentrancyGuard(dao) - returns (bool) - { + function approve( + address spender, + uint256 amount + ) public override reentrancyGuard(dao) returns (bool) { address senderAddr = dao.getAddressIfDelegated(msg.sender); require( DaoHelper.isNotZeroAddress(senderAddr), @@ -235,11 +230,10 @@ contract ERC20Extension is AdapterGuard, IExtension, IERC20 { * * Emits a {Transfer} event. */ - function transfer(address recipient, uint256 amount) - public - override - returns (bool) - { + function transfer( + address recipient, + uint256 amount + ) public override returns (bool) { return transferFrom( dao.getAddressIfDelegated(msg.sender), @@ -334,11 +328,9 @@ contract ERC20Extension is AdapterGuard, IExtension, IERC20 { return false; } - function bytes32ToString(bytes32 _bytes32) - internal - pure - returns (string memory) - { + function bytes32ToString( + bytes32 _bytes32 + ) internal pure returns (string memory) { uint8 i = 0; while (i < 32 && _bytes32[i] != 0) { i++; diff --git a/contracts/extensions/token/erc20/ERC20TokenExtensionFactory.sol b/contracts/extensions/token/erc20/ERC20TokenExtensionFactory.sol index 9d260cb38..8e1507e46 100644 --- a/contracts/extensions/token/erc20/ERC20TokenExtensionFactory.sol +++ b/contracts/extensions/token/erc20/ERC20TokenExtensionFactory.sol @@ -79,12 +79,9 @@ contract ERC20TokenExtensionFactory is IFactory, CloneFactory, ReentrancyGuard { * because it is prone to front-running attacks. During the extension creation it is safer to * read the new extension address from the event generated in the create call transaction. */ - function getExtensionAddress(address dao) - external - view - override - returns (address) - { + function getExtensionAddress( + address dao + ) external view override returns (address) { return _extensions[dao]; } } diff --git a/contracts/extensions/token/erc20/ERC20TransferStrategySimple.sol b/contracts/extensions/token/erc20/ERC20TransferStrategySimple.sol index 1c219e038..198d54ff4 100644 --- a/contracts/extensions/token/erc20/ERC20TransferStrategySimple.sol +++ b/contracts/extensions/token/erc20/ERC20TransferStrategySimple.sol @@ -43,11 +43,10 @@ contract ERC20TransferStrategySimple is IERC20TransferStrategy { /// @notice Clonable contract must have an empty constructor // constructor() {} - function hasBankAccess(DaoRegistry dao, address caller) - public - view - returns (bool) - { + function hasBankAccess( + DaoRegistry dao, + address caller + ) public view returns (bool) { return dao.hasAdapterAccessToExtension( caller, diff --git a/contracts/extensions/token/erc20/ERC20TransferStrategyWithVesting.sol b/contracts/extensions/token/erc20/ERC20TransferStrategyWithVesting.sol index 29b2f0859..257eada74 100644 --- a/contracts/extensions/token/erc20/ERC20TransferStrategyWithVesting.sol +++ b/contracts/extensions/token/erc20/ERC20TransferStrategyWithVesting.sol @@ -43,11 +43,10 @@ contract ERC20TransferStrategy is IERC20TransferStrategy { /// @notice Clonable contract must have an empty constructor // constructor() {} - function hasBankAccess(DaoRegistry dao, address caller) - public - view - returns (bool) - { + function hasBankAccess( + DaoRegistry dao, + address caller + ) public view returns (bool) { return dao.hasAdapterAccessToExtension( caller, diff --git a/contracts/extensions/token/erc20/InternalTokenVestingExtension.sol b/contracts/extensions/token/erc20/InternalTokenVestingExtension.sol index 6246ddae8..9449be755 100644 --- a/contracts/extensions/token/erc20/InternalTokenVestingExtension.sol +++ b/contracts/extensions/token/erc20/InternalTokenVestingExtension.sol @@ -135,11 +135,10 @@ contract InternalTokenVestingExtension is IExtension { * @param member The member address to update the balance. * @param internalToken The internal DAO token in which the member will receive the funds. */ - function getMinimumBalance(address member, address internalToken) - external - view - returns (uint88) - { + function getMinimumBalance( + address member, + address internalToken + ) external view returns (uint88) { VestingSchedule storage schedule = vesting[member][internalToken]; return getMinimumBalanceInternal( diff --git a/contracts/extensions/token/erc20/InternalTokenVestingExtensionFactory.sol b/contracts/extensions/token/erc20/InternalTokenVestingExtensionFactory.sol index 07e8d1470..e14fa9221 100644 --- a/contracts/extensions/token/erc20/InternalTokenVestingExtensionFactory.sol +++ b/contracts/extensions/token/erc20/InternalTokenVestingExtensionFactory.sol @@ -81,12 +81,9 @@ contract InternalTokenVestingExtensionFactory is * because it is prone to front-running attacks. During the extension creation it is safer to * read the new extension address from the event generated in the create call transaction. */ - function getExtensionAddress(address dao) - external - view - override - returns (address) - { + function getExtensionAddress( + address dao + ) external view override returns (address) { return _extensions[dao]; } } diff --git a/contracts/guards/MemberGuard.sol b/contracts/guards/MemberGuard.sol index c24c64ccf..47f780f5e 100644 --- a/contracts/guards/MemberGuard.sol +++ b/contracts/guards/MemberGuard.sol @@ -47,11 +47,10 @@ abstract contract MemberGuard { require(isActiveMember(dao, _addr), "onlyMember"); } - function isActiveMember(DaoRegistry dao, address _addr) - public - view - returns (bool) - { + function isActiveMember( + DaoRegistry dao, + address _addr + ) public view returns (bool) { address bankAddress = dao.extensions(DaoHelper.BANK); if (bankAddress != address(0x0)) { address memberAddr = DaoHelper.msgSender(dao, _addr); diff --git a/contracts/helpers/DaoHelper.sol b/contracts/helpers/DaoHelper.sol index 06f962de5..e96da6d78 100644 --- a/contracts/helpers/DaoHelper.sol +++ b/contracts/helpers/DaoHelper.sol @@ -88,29 +88,26 @@ library DaoHelper { /** * @notice calculates the total number of units. */ - function priorTotalTokens(BankExtension bank, uint256 at) - internal - view - returns (uint256) - { + function priorTotalTokens( + BankExtension bank, + uint256 at + ) internal view returns (uint256) { return priorMemberTokens(bank, TOTAL, at) - priorMemberTokens(bank, GUILD, at); } - function memberTokens(BankExtension bank, address member) - internal - view - returns (uint256) - { + function memberTokens( + BankExtension bank, + address member + ) internal view returns (uint256) { return bank.balanceOf(member, UNITS) + bank.balanceOf(member, LOOT); } - function msgSender(DaoRegistry dao, address addr) - internal - view - returns (address) - { + function msgSender( + DaoRegistry dao, + address addr + ) internal view returns (address) { address memberAddress = dao.getAddressIfDelegated(addr); address delegatedAddress = dao.getCurrentDelegateKey(addr); @@ -147,9 +144,9 @@ library DaoHelper { ) internal pure returns (uint256) { if (getFlag(flags, flag) != value) { if (value) { - return flags + 2**flag; + return flags + 2 ** flag; } else { - return flags - 2**flag; + return flags - 2 ** flag; } } else { return flags; @@ -191,11 +188,9 @@ library DaoHelper { * 3. The sender is an adapter. */ // slither-disable-next-line calls-loop - function isInCreationModeAndHasAccess(DaoRegistry dao) - internal - view - returns (bool) - { + function isInCreationModeAndHasAccess( + DaoRegistry dao + ) internal view returns (bool) { return dao.state() == DaoRegistry.DaoState.CREATION && (dao.getNbMembers() == 0 || diff --git a/contracts/nft/TributeERC721.sol b/contracts/nft/TributeERC721.sol index 777b87ce2..35cc0defc 100644 --- a/contracts/nft/TributeERC721.sol +++ b/contracts/nft/TributeERC721.sol @@ -60,11 +60,9 @@ contract TributeERC721 is setBaseURI("ipfs://"); } - function _authorizeUpgrade(address newImplementation) - internal - override - onlyOwner - {} + function _authorizeUpgrade( + address newImplementation + ) internal override onlyOwner {} function mint( address owner, @@ -121,13 +119,9 @@ contract TributeERC721 is baseURI = newBaseURI; } - function tokenURI(uint256) - public - view - virtual - override - returns (string memory) - { + function tokenURI( + uint256 + ) public view virtual override returns (string memory) { return string( abi.encodePacked( @@ -158,11 +152,10 @@ contract TributeERC721 is return hashMessage(dao, address(this), message); } - function getPriorAmount(address account, uint256 blockNumber) - external - view - returns (uint256) - { + function getPriorAmount( + address account, + uint256 blockNumber + ) external view returns (uint256) { require( blockNumber < block.number, "nft::getPriorAmount: not yet determined" @@ -223,11 +216,9 @@ contract TributeERC721 is } } - function bytes32ToString(bytes32 _bytes32) - public - pure - returns (string memory) - { + function bytes32ToString( + bytes32 _bytes32 + ) public pure returns (string memory) { uint8 i = 0; while (i < 32 && _bytes32[i] != 0) { i++; diff --git a/contracts/test/ERC1155TestToken.sol b/contracts/test/ERC1155TestToken.sol index fa923f42f..17238a1a2 100644 --- a/contracts/test/ERC1155TestToken.sol +++ b/contracts/test/ERC1155TestToken.sol @@ -85,7 +85,9 @@ contract ERC1155TestToken is Context, AccessControlEnumerable, ERC1155 { /** * @dev See {IERC165-supportsInterface}. */ - function supportsInterface(bytes4 interfaceId) + function supportsInterface( + bytes4 interfaceId + ) public view virtual diff --git a/contracts/test/OLToken.sol b/contracts/test/OLToken.sol index 24a711ff1..17b847b81 100644 --- a/contracts/test/OLToken.sol +++ b/contracts/test/OLToken.sol @@ -38,11 +38,10 @@ contract OLToken is ERC20 { * reads the current balance, but ideally it would have an internal storage to track the * historical balances of each token holder. */ - function getPriorAmount(address account, uint256) - public - view - returns (uint256) - { + function getPriorAmount( + address account, + uint256 + ) public view returns (uint256) { return balanceOf(account); } } diff --git a/contracts/test/PixelNFT.sol b/contracts/test/PixelNFT.sol index cda5d72a3..68952b57c 100644 --- a/contracts/test/PixelNFT.sol +++ b/contracts/test/PixelNFT.sol @@ -61,11 +61,7 @@ contract PixelNFT is ERC721 { _dimension = dimension; } - function mintPixel( - address recipient, - uint32 x, - uint32 y - ) external { + function mintPixel(address recipient, uint32 x, uint32 y) external { require( x < _dimension && y < _dimension, "maximum amount of pixels exceeded" diff --git a/contracts/test/TestToken1.sol b/contracts/test/TestToken1.sol index b2ce80650..6775be8fa 100644 --- a/contracts/test/TestToken1.sol +++ b/contracts/test/TestToken1.sol @@ -29,6 +29,6 @@ SOFTWARE. */ contract TestToken1 is ERC20 { constructor(uint256 _totalSupply) ERC20("TestToken1", "TT1") { - _mint(msg.sender, _totalSupply * (10**uint256(decimals()))); + _mint(msg.sender, _totalSupply * (10 ** uint256(decimals()))); } } diff --git a/contracts/test/TestToken2.sol b/contracts/test/TestToken2.sol index 4933e2498..f30cc3f72 100644 --- a/contracts/test/TestToken2.sol +++ b/contracts/test/TestToken2.sol @@ -28,6 +28,6 @@ SOFTWARE. */ contract TestToken2 is ERC20 { constructor(uint256 _totalSupply) ERC20("TestToken2", "TT2") { - _mint(msg.sender, _totalSupply * (10**uint256(decimals()))); + _mint(msg.sender, _totalSupply * (10 ** uint256(decimals()))); } } diff --git a/contracts/test/TributeERC721V2.sol b/contracts/test/TributeERC721V2.sol index bac725f0d..f5c035bdc 100644 --- a/contracts/test/TributeERC721V2.sol +++ b/contracts/test/TributeERC721V2.sol @@ -61,11 +61,9 @@ contract TributeERC721V2 is setBaseURI("ipfs://"); } - function _authorizeUpgrade(address newImplementation) - internal - override - onlyOwner - {} + function _authorizeUpgrade( + address newImplementation + ) internal override onlyOwner {} function mint( address owner, @@ -122,13 +120,9 @@ contract TributeERC721V2 is baseURI = newBaseURI; } - function tokenURI(uint256) - public - view - virtual - override - returns (string memory) - { + function tokenURI( + uint256 + ) public view virtual override returns (string memory) { return string( abi.encodePacked( @@ -159,11 +153,10 @@ contract TributeERC721V2 is return hashMessage(dao, address(this), message); } - function getPriorAmount(address account, uint256 blockNumber) - external - view - returns (uint256) - { + function getPriorAmount( + address account, + uint256 blockNumber + ) external view returns (uint256) { require( blockNumber < block.number, "nft::getPriorAmount: not yet determined" @@ -224,11 +217,9 @@ contract TributeERC721V2 is } } - function bytes32ToString(bytes32 _bytes32) - public - pure - returns (string memory) - { + function bytes32ToString( + bytes32 _bytes32 + ) public pure returns (string memory) { uint8 i = 0; while (i < 32 && _bytes32[i] != 0) { i++; diff --git a/contracts/utils/Multicall.sol b/contracts/utils/Multicall.sol index bad2b55d1..0b7b1d2d8 100644 --- a/contracts/utils/Multicall.sol +++ b/contracts/utils/Multicall.sol @@ -13,10 +13,9 @@ contract Multicall { bytes callData; } - function aggregate(Call[] calldata calls) - external - returns (uint256 blockNumber, bytes[] memory returnData) - { + function aggregate( + Call[] calldata calls + ) external returns (uint256 blockNumber, bytes[] memory returnData) { blockNumber = block.number; returnData = new bytes[](calls.length); for (uint256 i = 0; i < calls.length; i++) { @@ -33,11 +32,9 @@ contract Multicall { balance = addr.balance; } - function getBlockHash(uint256 blockNumber) - public - view - returns (bytes32 blockHash) - { + function getBlockHash( + uint256 blockNumber + ) public view returns (bytes32 blockHash) { blockHash = blockhash(blockNumber); } diff --git a/contracts/utils/Signatures.sol b/contracts/utils/Signatures.sol index 62a8eb1ef..8e8115448 100644 --- a/contracts/utils/Signatures.sol +++ b/contracts/utils/Signatures.sol @@ -51,11 +51,10 @@ abstract contract Signatures { ); } - function domainSeparator(DaoRegistry dao, address actionId) - public - view - returns (bytes32) - { + function domainSeparator( + DaoRegistry dao, + address actionId + ) public view returns (bytes32) { return keccak256( abi.encode(