Skip to content

Commit

Permalink
npm run lint:fix
Browse files Browse the repository at this point in the history
  • Loading branch information
adridadou committed Mar 22, 2024
1 parent 1db345e commit aa9f301
Show file tree
Hide file tree
Showing 57 changed files with 491 additions and 664 deletions.
24 changes: 11 additions & 13 deletions contracts/adapters/BankAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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;
Expand All @@ -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(
Expand Down
9 changes: 4 additions & 5 deletions contracts/adapters/Configuration.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
9 changes: 4 additions & 5 deletions contracts/adapters/CouponBurn.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 4 additions & 5 deletions contracts/adapters/CouponOnboarding.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions contracts/adapters/DaoRegistryAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
18 changes: 8 additions & 10 deletions contracts/adapters/Distribute.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)][
Expand Down
9 changes: 4 additions & 5 deletions contracts/adapters/Financing.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
9 changes: 4 additions & 5 deletions contracts/adapters/GuildKick.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
27 changes: 12 additions & 15 deletions contracts/adapters/KycOnboarding.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}
}
30 changes: 15 additions & 15 deletions contracts/adapters/LendNFT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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 ||
Expand Down
40 changes: 18 additions & 22 deletions contracts/adapters/Manager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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,
Expand All @@ -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(
Expand All @@ -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(
Expand Down
23 changes: 12 additions & 11 deletions contracts/adapters/Managing.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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
];
Expand Down
Loading

0 comments on commit aa9f301

Please sign in to comment.