Skip to content

Commit

Permalink
move new DAO code to new files
Browse files Browse the repository at this point in the history
trying to stick to our practice of keeping live mainnet code untouched
  • Loading branch information
eladmallel committed Oct 11, 2023
1 parent a042c33 commit e990e8d
Show file tree
Hide file tree
Showing 11 changed files with 3,703 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -696,8 +696,6 @@ contract NounsDAOStorageV3 {
INounsDAOForkEscrow forkEscrow;
/// @notice address of the DAO's fork deployer contract
IForkDAODeployer forkDAODeployer;
/// @notice the age of a noun, in noun ids, for a noun to be allowed to fork
uint16 nounAgeRequiredToFork;
/// @notice ERC20 tokens to include when sending funds to a deployed fork
address[] erc20TokensToIncludeInFork;
/// @notice The treasury contract of the last deployed fork
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -803,10 +803,6 @@ contract NounsDAOLogicV3 is NounsDAOStorageV3, NounsDAOEventsV3 {
ds._setForkThresholdBPS(newForkThresholdBPS);
}

function _setNounAgeRequiredToFork(uint16 newNounAgeRequiredToFork) external {
ds._setNounAgeRequiredToFork(newNounAgeRequiredToFork);
}

/**
* @notice Admin function for setting the proposal id at which vote snapshots start using the voting start block
* instead of the proposal creation block.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -559,15 +559,6 @@ library NounsDAOV3Admin {
ds.forkThresholdBPS = newForkThresholdBPS;
}

function _setNounAgeRequiredToFork(NounsDAOStorageV3.StorageV3 storage ds, uint16 newNounAgeRequiredToFork)
external
onlyAdmin(ds)
{
emit NounAgeRequiredToForkSet(ds.nounAgeRequiredToFork, newNounAgeRequiredToFork);

ds.nounAgeRequiredToFork = newNounAgeRequiredToFork;
}

/**
* @notice Admin function for setting the timelocks and admin
* @param timelock the new timelock contract
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@ pragma solidity ^0.8.19;
import { NounsDAOStorageV3, INounsDAOForkEscrow, INounsDAOExecutorV2 } from '../NounsDAOInterfaces.sol';
import { IERC20 } from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import { NounsTokenFork } from './newdao/token/NounsTokenFork.sol';
import { INounsAuctionHouseV2 } from '../../interfaces/INounsAuctionHouseV2.sol';

library NounsDAOV3Fork {
error ForkThresholdNotMet();
error ForkPeriodNotActive();
error ForkPeriodActive();
error AdminOnly();
error UseAlternativeWithdrawFunction();
error NounIdNotOldEnough();

/// @notice Emitted when someones adds nouns to the fork escrow
event EscrowedToFork(
Expand Down Expand Up @@ -83,7 +81,6 @@ library NounsDAOV3Fork {
INounsDAOForkEscrow forkEscrow = ds.forkEscrow;

for (uint256 i = 0; i < tokenIds.length; i++) {
checkNounIdIsAllowedToFork(ds, tokenIds[i]);
ds.nouns.safeTransferFrom(msg.sender, address(forkEscrow), tokenIds[i]);
}

Expand Down Expand Up @@ -154,7 +151,6 @@ library NounsDAOV3Fork {
sendProRataTreasury(ds, ds.forkDAOTreasury, tokenIds.length, adjustedTotalSupply(ds));

for (uint256 i = 0; i < tokenIds.length; i++) {
checkNounIdIsAllowedToFork(ds, tokenIds[i]);
ds.nouns.transferFrom(msg.sender, timelock, tokenIds[i]);
}

Expand Down Expand Up @@ -220,13 +216,6 @@ library NounsDAOV3Fork {
return ds.forkEscrow.numTokensInEscrow();
}

function checkNounIdIsAllowedToFork(NounsDAOStorageV3.StorageV3 storage ds, uint256 tokenId) internal view {
if (ds.nounAgeRequiredToFork == 0) return;

uint256 auctionedNounId = INounsAuctionHouseV2(ds.nouns.minter()).auction().nounId;
if (tokenId < auctionedNounId - ds.nounAgeRequiredToFork) revert NounIdNotOldEnough();
}

/**
* @notice Returns the number of nouns in supply minus nouns owned by the DAO, i.e. held in the treasury or in an
* escrow after it has closed.
Expand Down
Loading

0 comments on commit e990e8d

Please sign in to comment.