Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAO V3.1: fix vote gas refund #813

Merged
merged 29 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
add8aca
fix vote gas refund
eladmallel Nov 7, 2023
5ddcd44
fix CR comment: edit test instead of duplicating
eladmallel Nov 8, 2023
0444a0f
delete dao v1 voting test
eladmallel Nov 8, 2023
3e47b78
delete old dao logic test
eladmallel Nov 8, 2023
2080f58
point castVote tests to V3
eladmallel Nov 8, 2023
d211b97
point DQ tests to V3
eladmallel Nov 8, 2023
0c725c1
point propose test to V3 and move to foundry
eladmallel Nov 8, 2023
fb552ec
point proxy test to V3
eladmallel Nov 8, 2023
606e319
point quorumConfig test to V3
eladmallel Nov 8, 2023
34e7a15
remove tests for V1 > V2 upgrade
eladmallel Nov 8, 2023
b73ba89
remove dao V1 e2e test
eladmallel Nov 8, 2023
48d057d
remove old descriptor V1 test
eladmallel Nov 8, 2023
ddaf63b
remove DAO V2 test folder
eladmallel Nov 8, 2023
5464880
remove old V1 > V2 upgrade test
eladmallel Nov 8, 2023
989ab78
remove dao V1 tests and point V2 tests to V3
eladmallel Nov 10, 2023
2906230
remove dao V1 from scripts
eladmallel Nov 10, 2023
dceba18
remove unused test contract
eladmallel Nov 10, 2023
70d243a
remove DAO V1 from a script import
eladmallel Nov 10, 2023
325aa25
remove DAO V1 import from tests
eladmallel Nov 10, 2023
0eaa244
remove upgrade tests we don't need
eladmallel Nov 10, 2023
7369e47
point more tests to dao V3
eladmallel Nov 10, 2023
f9ec85d
cleanup
eladmallel Nov 10, 2023
8eca105
point veto to test to V3
eladmallel Nov 10, 2023
1007958
actually delete the moved veto test
eladmallel Nov 10, 2023
7efa119
remove unused file
eladmallel Nov 13, 2023
2d11504
add upgrade fork test
eladmallel Nov 14, 2023
69bb3e7
fix build
eladmallel Nov 14, 2023
d74ab7b
Merge branch 'master' into verbs-dao-v3-fix-vote-gas-refund-blunder
eladmallel Nov 15, 2023
2a943ca
add refund test before and after the upgrade
eladmallel Nov 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ library NounsDAOV3Votes {
uint256 gasPrice = min(tx.gasprice, basefee + MAX_REFUND_PRIORITY_FEE);
uint256 gasUsed = min(startGas - gasleft() + REFUND_BASE_GAS, MAX_REFUND_GAS_USED);
uint256 refundAmount = min(gasPrice * gasUsed, balance);
(bool refundSent, ) = msg.sender.call{ value: refundAmount }('');
emit RefundableVote(msg.sender, refundAmount, refundSent);
(bool refundSent, ) = tx.origin.call{ value: refundAmount }('');
emit RefundableVote(tx.origin, refundAmount, refundSent);
}
}

Expand Down
44 changes: 0 additions & 44 deletions packages/nouns-contracts/contracts/test/NounsDAOImmutable.sol

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@
pragma solidity ^0.8.15;

import 'forge-std/Script.sol';
import { NounsDAOLogicV1 } from '../contracts/governance/NounsDAOLogicV1.sol';
import { NounsDAOData } from '../contracts/governance/data/NounsDAOData.sol';
import { NounsDAODataProxy } from '../contracts/governance/data/NounsDAODataProxy.sol';

interface NounsDAO {
function nouns() external view returns (address);
}

contract DeployDAOV3DataContractsBase is Script {
uint256 public constant CREATE_CANDIDATE_COST = 0.01 ether;

NounsDAOLogicV1 public immutable daoProxy;
NounsDAO public immutable daoProxy;
address public immutable timelockV2Proxy;

constructor(address _daoProxy, address _timelockV2Proxy) {
daoProxy = NounsDAOLogicV1(payable(_daoProxy));
daoProxy = NounsDAO(_daoProxy);
timelockV2Proxy = _timelockV2Proxy;
}

Expand All @@ -22,7 +25,7 @@ contract DeployDAOV3DataContractsBase is Script {

vm.startBroadcast(deployerKey);

NounsDAOData dataLogic = new NounsDAOData(address(daoProxy.nouns()), address(daoProxy));
NounsDAOData dataLogic = new NounsDAOData(daoProxy.nouns(), address(daoProxy));

bytes memory initCallData = abi.encodeWithSignature(
'initialize(address,uint256,uint256,address)',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pragma solidity ^0.8.15;
import 'forge-std/Script.sol';
import { NounsDAOExecutorV2 } from '../contracts/governance/NounsDAOExecutorV2.sol';
import { NounsDAOExecutorV2Test } from '../contracts/test/NounsDAOExecutorHarness.sol';
import { NounsDAOLogicV1 } from '../contracts/governance/NounsDAOLogicV1.sol';
import { NounsDAOLogicV3 } from '../contracts/governance/NounsDAOLogicV3.sol';
import { NounsDAOExecutorProxy } from '../contracts/governance/NounsDAOExecutorProxy.sol';
import { INounsDAOExecutor } from '../contracts/governance/NounsDAOInterfaces.sol';
Expand All @@ -15,14 +14,18 @@ import { NounsDAOLogicV1Fork } from '../contracts/governance/fork/newdao/governa
import { ForkDAODeployer } from '../contracts/governance/fork/ForkDAODeployer.sol';
import { ERC20Transferer } from '../contracts/utils/ERC20Transferer.sol';

interface NounsDAO {
function nouns() external view returns (address);
}

contract DeployDAOV3NewContractsBase is Script {
uint256 public constant DELAYED_GOV_DURATION = 30 days;
uint256 public immutable forkDAOVotingPeriod;
uint256 public immutable forkDAOVotingDelay;
uint256 public constant FORK_DAO_PROPOSAL_THRESHOLD_BPS = 25; // 0.25%
uint256 public constant FORK_DAO_QUORUM_VOTES_BPS = 1000; // 10%

NounsDAOLogicV1 public immutable daoProxy;
NounsDAO public immutable daoProxy;
INounsDAOExecutor public immutable timelockV1;
bool public immutable deployTimelockV2Harness; // should be true only for testnets

Expand All @@ -33,7 +36,7 @@ contract DeployDAOV3NewContractsBase is Script {
uint256 _forkDAOVotingPeriod,
uint256 _forkDAOVotingDelay
) {
daoProxy = NounsDAOLogicV1(payable(_daoProxy));
daoProxy = NounsDAO(_daoProxy);
timelockV1 = INounsDAOExecutor(_timelockV1);
deployTimelockV2Harness = _deployTimelockV2Harness;
forkDAOVotingPeriod = _forkDAOVotingPeriod;
Expand Down
16 changes: 12 additions & 4 deletions packages/nouns-contracts/script/ProposeDAOV3UpgradeMainnet.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,22 @@
pragma solidity ^0.8.15;

import 'forge-std/Script.sol';
import { NounsDAOLogicV1 } from '../contracts/governance/NounsDAOLogicV1.sol';
import { NounsDAOForkEscrow } from '../contracts/governance/fork/NounsDAOForkEscrow.sol';
import { ForkDAODeployer } from '../contracts/governance/fork/ForkDAODeployer.sol';
import { IERC20 } from '@openzeppelin/contracts/token/ERC20/IERC20.sol';

interface NounsDAO {
function propose(
address[] memory targets,
uint256[] memory values,
string[] memory signatures,
bytes[] memory calldatas,
string memory description
) external returns (uint256);
}

contract ProposeDAOV3UpgradeMainnet is Script {
NounsDAOLogicV1 public constant NOUNS_DAO_PROXY_MAINNET =
NounsDAOLogicV1(0x6f3E6272A167e8AcCb32072d08E0957F9c79223d);
NounsDAO public constant NOUNS_DAO_PROXY_MAINNET = NounsDAO(0x6f3E6272A167e8AcCb32072d08E0957F9c79223d);
address public constant NOUNS_TIMELOCK_V1_MAINNET = 0x0BC3807Ec262cB779b38D65b38158acC3bfedE10;

uint256 public constant ETH_TO_SEND_TO_NEW_TIMELOCK = 2500 ether;
Expand Down Expand Up @@ -60,7 +68,7 @@ contract ProposeDAOV3UpgradeMainnet is Script {
}

function propose(
NounsDAOLogicV1 daoProxy,
NounsDAO daoProxy,
address daoV3Implementation,
address timelockV2,
uint256 ethToSendToNewTimelock,
Expand Down
23 changes: 15 additions & 8 deletions packages/nouns-contracts/script/ProposeDAOV3UpgradeTestnet.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,31 @@
pragma solidity ^0.8.15;

import 'forge-std/Script.sol';
import { NounsDAOLogicV1 } from '../contracts/governance/NounsDAOLogicV1.sol';
import { NounsDAOForkEscrow } from '../contracts/governance/fork/NounsDAOForkEscrow.sol';
import { ForkDAODeployer } from '../contracts/governance/fork/ForkDAODeployer.sol';

interface NounsDAO {
function propose(
address[] memory targets,
uint256[] memory values,
string[] memory signatures,
bytes[] memory calldatas,
string memory description
) external returns (uint256);
}

abstract contract ProposeDAOV3UpgradeTestnet is Script {
uint256 public constant ETH_TO_SEND_TO_NEW_TIMELOCK = 0.001 ether;
uint256 public constant FORK_PERIOD = 1 hours;
uint256 public constant FORK_THRESHOLD_BPS = 2000;

NounsDAOLogicV1 public immutable daoProxyContract;
NounsDAO public immutable daoProxyContract;
address public immutable timelockV1;
address public immutable auctionHouseProxy;
address public immutable stETH;

constructor(
NounsDAOLogicV1 daoProxy_,
NounsDAO daoProxy_,
address timelockV1_,
address auctionHouseProxy_,
address stETH_
Expand Down Expand Up @@ -60,7 +69,7 @@ abstract contract ProposeDAOV3UpgradeTestnet is Script {
}

function propose(
NounsDAOLogicV1 daoProxy,
NounsDAO daoProxy,
address daoV3Implementation,
address timelockV2,
uint256 ethToSendToNewTimelock,
Expand Down Expand Up @@ -139,8 +148,7 @@ abstract contract ProposeDAOV3UpgradeTestnet is Script {
}

contract ProposeDAOV3UpgradeGoerli is ProposeDAOV3UpgradeTestnet {
NounsDAOLogicV1 public constant NOUNS_DAO_PROXY_GOERLI =
NounsDAOLogicV1(0x9e6D4B42b8Dc567AC4aeCAB369Eb9a3156dF095C);
NounsDAO public constant NOUNS_DAO_PROXY_GOERLI = NounsDAO(0x9e6D4B42b8Dc567AC4aeCAB369Eb9a3156dF095C);
address public constant NOUNS_TIMELOCK_V1_GOERLI = 0xADa0F1A73D1df49477fa41C7F8476F9eA5aB115f;
address public constant AUCTION_HOUSE_PROXY_GOERLI = 0x17e8512851Db9F04164Aa54A6e62f368acCF9D0c;
address public constant STETH_GOERLI = 0x1643E812aE58766192Cf7D2Cf9567dF2C37e9B7F;
Expand All @@ -156,8 +164,7 @@ contract ProposeDAOV3UpgradeGoerli is ProposeDAOV3UpgradeTestnet {
}

contract ProposeDAOV3UpgradeSepolia is ProposeDAOV3UpgradeTestnet {
NounsDAOLogicV1 public constant NOUNS_DAO_PROXY_SEPOLIA =
NounsDAOLogicV1(0x35d2670d7C8931AACdd37C89Ddcb0638c3c44A57);
NounsDAO public constant NOUNS_DAO_PROXY_SEPOLIA = NounsDAO(0x35d2670d7C8931AACdd37C89Ddcb0638c3c44A57);
address public constant NOUNS_TIMELOCK_V1_SEPOLIA = 0x332db58b51393f3a6b28d4DD8964234967e1aD33;
address public constant AUCTION_HOUSE_PROXY_SEPOLIA = 0x488609b7113FCf3B761A05956300d605E8f6BcAf;
address public constant STETH_SEPOLIA = 0xf16e3ab44cC450fCbe5E890322Ee715f3f7eAC29; // ERC20Mock
Expand Down
105 changes: 0 additions & 105 deletions packages/nouns-contracts/test/descriptor.test.ts

This file was deleted.

Loading
Loading