Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/verbs-stream-escrow-fix-audit-is…
Browse files Browse the repository at this point in the history
…sue-184' into verbs-stream-escrow-audit-fixes
  • Loading branch information
davidbrai committed Dec 11, 2024
2 parents d9ec4b5 + eaab477 commit 4285edb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/nouns-contracts/contracts/StreamEscrow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ contract StreamEscrow is IStreamEscrow {
address streamCreator_,
uint32 minimumTickDuration_
) {
require(nounsRecipient_ != address(0), 'zero address');

daoExecutor = daoExecutor_;
ethRecipient = ethRecipient_;
nounsRecipient = nounsRecipient_;
Expand Down Expand Up @@ -295,8 +297,10 @@ contract StreamEscrow is IStreamEscrow {

/**
* @notice Allows the DAO to set the address that the Nouns tokens will be sent to when streams are canceled.
* The zero address is not allowed because it will cause the transfer to revert, which will cause all cancellations to revert.
*/
function setNounsRecipient(address newAddress) external onlyDAO {
require(newAddress != address(0), 'zero address');
nounsRecipient = newAddress;
emit NounsRecipientSet(newAddress);
}
Expand Down
11 changes: 11 additions & 0 deletions packages/nouns-contracts/test/foundry/StreamEscrow.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,17 @@ contract DAOSettersTest is BaseStreamEscrowTest {
// check that new recipient received the noun
assertEq(nounsToken.ownerOf(1), makeAddr('nounsRecipient2'));
}

function test_setNounsRecipient_cantBeZero() public {
vm.prank(treasury);
vm.expectRevert('zero address');
escrow.setNounsRecipient(address(0));
}

function test_nounsReceipient_cantBeZeroInConstructor() public {
vm.expectRevert('zero address');
new StreamEscrow(treasury, ethRecipient, address(0), address(nounsToken), streamCreator, 24 hours);
}
}

contract RescueTokensTest is BaseStreamEscrowTest {
Expand Down

0 comments on commit 4285edb

Please sign in to comment.