Skip to content

Commit

Permalink
fix(slither): disable low: reent-benign, reent-events
Browse files Browse the repository at this point in the history
  • Loading branch information
fforbeck committed Oct 4, 2021
1 parent 101da05 commit c7c8d13
Show file tree
Hide file tree
Showing 22 changed files with 44 additions and 11 deletions.
2 changes: 2 additions & 0 deletions contracts/adapters/Configuration.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ contract ConfigurationContract is IConfiguration, AdapterGuard {
* @param values The token to receive the funds.
* @param data Additional details about the financing proposal.
*/
// slither-disable-next-line reentrancy-benign
function submitProposal(
DaoRegistry dao,
bytes32 proposalId,
Expand Down Expand Up @@ -81,6 +82,7 @@ contract ConfigurationContract is IConfiguration, AdapterGuard {
* @param dao The DAO Address.
* @param proposalId The proposal id.
*/
// slither-disable-next-line reentrancy-benign
function processProposal(DaoRegistry dao, bytes32 proposalId)
external
override
Expand Down
3 changes: 2 additions & 1 deletion contracts/adapters/CouponOnboarding.sol
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ contract CouponOnboardingContract is AdapterGuard, Signatures {
* @param nonce is a unique identifier for this coupon request
* @param signature is message signature for verification
*/
// slither-disable-next-line reentrancy-benign
function redeemCoupon(
DaoRegistry dao,
address authorizedMember,
Expand Down Expand Up @@ -179,7 +180,7 @@ contract CouponOnboardingContract is AdapterGuard, Signatures {
} else {
erc20.safeTransferFrom(DaoHelper.GUILD, authorizedMember, amount);
}

//slither-disable-next-line reentrancy-events
emit CouponRedeemed(address(dao), nonce, authorizedMember, amount);
}
}
3 changes: 3 additions & 0 deletions contracts/adapters/Distribute.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ contract DistributeContract is IDistribute, AdapterGuard {
* @param amount The amount to distribute.
* @param data Additional information related to the distribution proposal.
*/
// slither-disable-next-line reentrancy-benign
function submitProposal(
DaoRegistry dao,
bytes32 proposalId,
Expand Down Expand Up @@ -240,6 +241,7 @@ contract DistributeContract is IDistribute, AdapterGuard {
if (unitHolderAddr != address(0x0)) {
distribution.status = DistributionStatus.DONE;
_distributeOne(bank, unitHolderAddr, blockNumber, token, amount);
//slither-disable-next-line reentrancy-events
emit Distributed(address(dao), token, amount, unitHolderAddr);
} else {
// Set the max index supported which is based on the number of members
Expand All @@ -252,6 +254,7 @@ contract DistributeContract is IDistribute, AdapterGuard {
distribution.currentIndex = maxIndex;
if (maxIndex == nbMembers) {
distribution.status = DistributionStatus.DONE;
//slither-disable-next-line reentrancy-events
emit Distributed(address(dao), token, amount, unitHolderAddr);
}

Expand Down
2 changes: 2 additions & 0 deletions contracts/adapters/Financing.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ contract FinancingContract is IFinancing, AdapterGuard {
* @param amount The desired amount.
* @param data Additional details about the financing proposal.
*/
// slither-disable-next-line reentrancy-benign
function submitProposal(
DaoRegistry dao,
bytes32 proposalId,
Expand Down Expand Up @@ -101,6 +102,7 @@ contract FinancingContract is IFinancing, AdapterGuard {
* @param dao The DAO Address.
* @param proposalId The proposal id.
*/
// slither-disable-next-line reentrancy-benign
function processProposal(DaoRegistry dao, bytes32 proposalId)
external
override
Expand Down
1 change: 1 addition & 0 deletions contracts/adapters/GuildKick.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ contract GuildKickContract is IGuildKick, AdapterGuard {
* @param memberToKick The member address that should be kicked out of the DAO.
* @param data Additional information related to the kick proposal.
*/
// slither-disable-next-line reentrancy-benign
function submitProposal(
DaoRegistry dao,
bytes32 proposalId,
Expand Down
2 changes: 2 additions & 0 deletions contracts/adapters/LendNFT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ contract LendNFTContract is AdapterGuard, IERC1155Receiver, IERC721Receiver {
* @param requestAmount The amount requested of DAO internal tokens (UNITS).
* @param data Additional information related to the tribute proposal.
*/
// slither-disable-next-line reentrancy-benign
function submitProposal(
DaoRegistry dao,
bytes32 proposalId,
Expand Down Expand Up @@ -222,6 +223,7 @@ contract LendNFTContract is AdapterGuard, IERC1155Receiver, IERC721Receiver {
/**
* @notice Sends the NFT back to the original owner.
*/
// slither-disable-next-line reentrancy-benign
function sendNFTBack(DaoRegistry dao, bytes32 proposalId)
external
reentrancyGuard(dao)
Expand Down
2 changes: 2 additions & 0 deletions contracts/adapters/Managing.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ contract ManagingContract is IManaging, AdapterGuard {
* @param proposal The proposal details
* @param data Additional data to pass to the voting contract and identify the submitter
*/
// slither-disable-next-line reentrancy-benign
function submitProposal(
DaoRegistry dao,
bytes32 proposalId,
Expand Down Expand Up @@ -97,6 +98,7 @@ contract ManagingContract is IManaging, AdapterGuard {
* @param dao The dao address.
* @param proposalId The guild kick proposal id.
*/
// slither-disable-next-line reentrancy-benign
function processProposal(DaoRegistry dao, bytes32 proposalId)
external
override
Expand Down
2 changes: 2 additions & 0 deletions contracts/adapters/Onboarding.sol
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ contract OnboardingContract is IOnboarding, AdapterGuard {
* @param tokenAmount The amount of token to mint.
* @param data Additional proposal information.
*/
// slither-disable-next-line reentrancy-benign
function submitProposal(
DaoRegistry dao,
bytes32 proposalId,
Expand Down Expand Up @@ -169,6 +170,7 @@ contract OnboardingContract is IOnboarding, AdapterGuard {
* @notice Once the vote on a proposal is finished, it is time to process it. Anybody can call this function.
* @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
Expand Down
5 changes: 4 additions & 1 deletion contracts/adapters/Ragequit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ contract RagequitContract is IRagequit, AdapterGuard {
* @param tokens The array of tokens that the funds should be sent to.
* @param bank The bank extension.
*/
// slither-disable-next-line reentrancy-events
function _prepareRagequit(
DaoRegistry dao,
address memberAddr,
Expand Down Expand Up @@ -206,7 +207,9 @@ contract RagequitContract is IRagequit, AdapterGuard {
}
}

// Once the units and loot were burned, and the transfers completed, emit an event to indicate a successfull operation.
// Once the units and loot were burned, and the transfers completed,
// emit an event to indicate a successfull operation.
//slither-disable-next-line reentrancy-events
emit MemberRagequit(
daoAddress,
memberAddr,
Expand Down
1 change: 1 addition & 0 deletions contracts/adapters/Signatures.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ contract SignaturesContract is ISignatures, AdapterGuard {
* @param magicValue The value to return when a signature is valid
* @param data Additional details about the signature proposal.
*/
// slither-disable-next-line reentrancy-benign
function submitProposal(
DaoRegistry dao,
bytes32 proposalId,
Expand Down
1 change: 1 addition & 0 deletions contracts/adapters/Tribute.sol
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ contract TributeContract is AdapterGuard {
* @param tributeTokenOwner The owner of the ERC-20 tokens being provided as tribute.
* @param data Additional information related to the tribute proposal.
*/
// slither-disable-next-line reentrancy-benign
function submitProposal(
DaoRegistry dao,
bytes32 proposalId,
Expand Down
1 change: 1 addition & 0 deletions contracts/adapters/TributeNFT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ contract TributeNFTContract is AdapterGuard, IERC1155Receiver, IERC721Receiver {
* @param requestAmount The amount requested of DAO internal tokens (UNITS).
* @param data Additional information related to the tribute proposal.
*/
// slither-disable-next-line reentrancy-benign
function submitProposal(
DaoRegistry dao,
bytes32 proposalId,
Expand Down
1 change: 1 addition & 0 deletions contracts/adapters/voting/OffchainVoting.sol
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,7 @@ contract OffchainVotingContract is IVoting, MemberGuard, AdapterGuard, Ownable {
dao.processProposal(proposalId);
}

// slither-disable-next-line reentrancy-events
function _challengeResult(DaoRegistry dao, bytes32 proposalId) internal {
BankExtension bank =
BankExtension(dao.getExtensionAddress(DaoHelper.BANK));
Expand Down
2 changes: 1 addition & 1 deletion contracts/core/DaoFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ contract DaoFactory is CloneFactory {
daos[daoAddr] = hashedName;

dao.initialize(creator, msg.sender);

//slither-disable-next-line reentrancy-events
emit DAOCreated(daoAddr, daoName);
}

Expand Down
1 change: 1 addition & 0 deletions contracts/core/DaoRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ contract DaoRegistry is MemberGuard, AdapterGuard {
* @param extension The address of the extension
* @param creator The DAO's creator, who will be an initial member
*/
// slither-disable-next-line reentrancy-events
function addExtension(
bytes32 extensionId,
IExtension extension,
Expand Down
2 changes: 2 additions & 0 deletions contracts/extensions/bank/Bank.sol
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ contract BankExtension is AdapterGuard, IExtension {
erc20.safeTransfer(member, amount);
}

//slither-disable-next-line reentrancy-events
emit Withdraw(member, tokenAddr, uint160(amount));
}

Expand Down Expand Up @@ -476,6 +477,7 @@ contract BankExtension is AdapterGuard, IExtension {
);
numCheckpoints[token][member] = nCheckpoints + 1;
}
//slither-disable-next-line reentrancy-events
emit NewBalance(member, token, newAmount);
}
}
1 change: 1 addition & 0 deletions contracts/extensions/bank/BankFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ contract BankFactory is CloneFactory {
function createBank(uint8 maxExternalTokens) external {
BankExtension bank = BankExtension(_createClone(identityAddress));
bank.setMaxExternalTokens(maxExternalTokens);
//slither-disable-next-line reentrancy-events
emit BankCreated(address(bank));
}
}
4 changes: 2 additions & 2 deletions contracts/extensions/erc1155/ERC1155TokenExtension.sol
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ contract ERC1155TokenExtension is
amount,
""
);

//slither-disable-next-line reentrancy-events
emit WithdrawnNFT(nftAddr, nftTokenId, amount, newOwner);
}

Expand Down Expand Up @@ -225,7 +225,7 @@ contract ERC1155TokenExtension is
nftTokenId,
tokenAmount - amount
);

//slither-disable-next-line reentrancy-events
emit TransferredNFT(fromOwner, toOwner, nftAddr, nftTokenId, amount);
}

Expand Down
8 changes: 5 additions & 3 deletions contracts/extensions/nft/NFT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ contract NFTExtension is AdapterGuard, IExtension, IERC721Receiver {
* @param nftAddr The NFT contract address.
* @param nftTokenId The NFT token id.
*/
// slither-disable-next-line reentrancy-benign
function collect(address nftAddr, uint256 nftTokenId)
external
hasExtensionAccess(this, AclFlag.COLLECT_NFT)
Expand All @@ -110,14 +111,14 @@ contract NFTExtension is AdapterGuard, IExtension, IERC721Receiver {
if (currentOwner == address(this)) {
if (_ownership[getNFTId(nftAddr, nftTokenId)] == address(0x0)) {
_saveNft(nftAddr, nftTokenId, DaoHelper.GUILD);

// slither-disable-next-line reentrancy-events
emit CollectedNFT(nftAddr, nftTokenId);
}
//If the NFT is not in the NFTExtension, we try to transfer from the current owner of the NFT to the extension
} else {
_saveNft(nftAddr, nftTokenId, DaoHelper.GUILD);
erc721.safeTransferFrom(currentOwner, address(this), nftTokenId);

// slither-disable-next-line reentrancy-events
emit CollectedNFT(nftAddr, nftTokenId);
}
}
Expand All @@ -132,6 +133,7 @@ contract NFTExtension is AdapterGuard, IExtension, IERC721Receiver {
* @param nftAddr The NFT address that must be in ERC721 standard.
* @param nftTokenId The NFT token id.
*/
// slither-disable-next-line reentrancy-benign
function withdrawNFT(
address newOwner,
address nftAddr,
Expand All @@ -154,7 +156,7 @@ contract NFTExtension is AdapterGuard, IExtension, IERC721Receiver {
"erc721::can not remove nft"
);
}

//slither-disable-next-line reentrancy-events
emit WithdrawnNFT(nftAddr, nftTokenId, newOwner);
}

Expand Down
1 change: 1 addition & 0 deletions contracts/extensions/nft/NFTCollectionFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ contract NFTCollectionFactory is CloneFactory {
*/
function createNFTCollection() external {
NFTExtension extension = NFTExtension(_createClone(identityAddress));
// slither-disable-next-line reentrancy-events
emit NFTCollectionCreated(address(extension));
}
}
9 changes: 6 additions & 3 deletions contracts/extensions/token/erc20/ERC20TokenExtension.sol
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ contract ERC20Extension is AdapterGuard, IExtension, IERC20 {
*
* Emits an {Approval} event.
*/
//slither-disable-next-line reentrancy-benign
// slither-disable-next-line reentrancy-benign
function approve(address spender, uint256 amount)
public
override
Expand All @@ -216,6 +216,7 @@ contract ERC20Extension is AdapterGuard, IExtension, IERC20 {
);

_allowances[senderAddr][spender] = amount;
// slither-disable-next-line reentrancy-events
emit Approval(senderAddr, spender, amount);
return true;
}
Expand Down Expand Up @@ -251,8 +252,6 @@ contract ERC20Extension is AdapterGuard, IExtension, IERC20 {
) internal {
DaoHelper.potentialNewMember(recipient, dao, bank);
bank.internalTransfer(senderAddr, recipient, tokenAddress, amount);

emit Transfer(senderAddr, recipient, amount);
}

/**
Expand Down Expand Up @@ -304,6 +303,8 @@ contract ERC20Extension is AdapterGuard, IExtension, IERC20 {

if (approvalType == IERC20TransferStrategy.ApprovalType.SPECIAL) {
_transferInternal(sender, recipient, amount, bank);
//slither-disable-next-line reentrancy-events
emit Transfer(sender, recipient, amount);
return true;
}

Expand All @@ -322,6 +323,8 @@ contract ERC20Extension is AdapterGuard, IExtension, IERC20 {

if (allowedAmount >= amount) {
_transferInternal(sender, recipient, amount, bank);
//slither-disable-next-line reentrancy-events
emit Transfer(sender, recipient, amount);
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ contract ERC20TokenExtensionFactory is CloneFactory {
ext.setToken(tokenAddress);
ext.setSymbol(tokenSymbol);
ext.setDecimals(decimals);
// slither-disable-next-line reentrancy-events
emit ERC20TokenExtensionCreated(address(ext));
}
}

0 comments on commit c7c8d13

Please sign in to comment.