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

The Burn: spend or burn excess ETH, every N Noun mints #803

Draft
wants to merge 130 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 120 commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
332b906
initial Noracle lib implementation
eladmallel Oct 17, 2022
b3389ea
noracle bit packing
eladmallel Oct 18, 2022
971f661
noracle: test high price keeps 8 decimals
eladmallel Oct 18, 2022
e17cf14
noracle: gas optimizations and cleanups
eladmallel Oct 18, 2022
c3e20bf
noracle: start testing auction house V2 with oracle
eladmallel Oct 18, 2022
467f9c6
rename
eladmallel Oct 19, 2022
6ebb899
noracle: add integration tests with auction house v2
eladmallel Oct 19, 2022
36b976f
noracle: add tests
eladmallel Oct 19, 2022
3e1d9b6
noracle: trim observations array
eladmallel Oct 19, 2022
7c2d516
noracle: emit event when price history grows
eladmallel Oct 19, 2022
5468d13
noracle: add bits to observation amount
eladmallel Oct 24, 2022
b855726
noracle: clean up `observe`
eladmallel Oct 24, 2022
07230d5
noracle: deploy test token with descriptor v2
eladmallel Oct 24, 2022
e8c3a39
cleanup
eladmallel Oct 24, 2022
c5d32d7
Merge branch 'master' into verbs-noracle-spike
eladmallel Oct 27, 2022
0d4daaf
noracle: storage read gas optimization
eladmallel Oct 27, 2022
1a55f4a
noracle: nit fix
eladmallel Oct 27, 2022
d208708
noracle: gas nit
eladmallel Oct 27, 2022
43c4b9b
noracle: optimize grow event gas
eladmallel Oct 27, 2022
eaa90b9
noracle: write doesnt revert when not initialized
eladmallel Oct 27, 2022
d3ba861
add task to deploy auction house v2
eladmallel Oct 27, 2022
db9d159
noracle: add natspec
eladmallel Oct 28, 2022
06d8335
Merge branch 'master' into verbs-noracle-spike
eladmallel Oct 31, 2022
0ee50ec
remove unnecessary nonReentrant modifiers
eladmallel Oct 31, 2022
25ef147
move lastBidder refund down the bid function
eladmallel Oct 31, 2022
c09992d
remove unnecessary nonReentrant modifier from createBid
eladmallel Oct 31, 2022
7485280
auction house: fix gas griefing
eladmallel Oct 31, 2022
840616a
auctionhousev2: optimize auction struct bits
eladmallel Oct 31, 2022
81aa3da
cleanup
eladmallel Oct 31, 2022
2396eab
convert require strings to custom errors
eladmallel Oct 31, 2022
c608be6
cleanup
eladmallel Oct 31, 2022
f7a5146
zero out auction V1 state vars
eladmallel Nov 1, 2022
7871bc6
Merge pull request #610 from nounsDAO/verbs-auctionhousev2-gas-optimi…
eladmallel Nov 2, 2022
8902926
noracle: trim observations more efficiently
eladmallel Nov 2, 2022
d1da1bb
noracle: minor gas optimization
eladmallel Nov 2, 2022
644aced
add inline comment
eladmallel Nov 2, 2022
06045cc
update auction house v2 deploy
eladmallel Nov 7, 2022
5f10c47
add test for v1 getter compatibility
eladmallel Nov 7, 2022
23be80f
Merge branch 'master' into verbs-noracle-spike
eladmallel Nov 25, 2022
9e53560
update higher cardinality test
eladmallel Nov 25, 2022
1c94df1
noracle: natspec update
eladmallel Nov 25, 2022
647a3fe
add tests and inline comments
eladmallel Nov 28, 2022
b84d5a8
cleanup tests
eladmallel Nov 29, 2022
1ee422a
CR cleanups
eladmallel Nov 29, 2022
97592c2
Merge branch 'master' into verbs-noracle-spike
eladmallel Jan 4, 2023
3911ccd
infinite oracle initial version
eladmallel Jan 6, 2023
2c00c82
rename
eladmallel Jan 13, 2023
7681486
add a function to warm up settlement history state
eladmallel Jan 13, 2023
2bafcaf
Merge branch 'master' into verbs-auctionv2-infinite-oracle
eladmallel Sep 26, 2023
7abbf30
ah: better skipping of nouns with no price history
eladmallel Sep 26, 2023
1a6f21a
fix natspec
eladmallel Sep 26, 2023
77ec541
ah: flip the order of ranged prices view function
eladmallel Sep 26, 2023
364b1a8
ah: add tests for skipping missing auction data
eladmallel Sep 27, 2023
5f13129
ah: update user-facing oracle prices to 18 decimals
eladmallel Sep 27, 2023
0289762
ah: add hardcoded max time buffer
eladmallel Sep 27, 2023
4fe9197
ah: add a price history admin role
eladmallel Sep 27, 2023
03ac124
delete unused event
eladmallel Sep 27, 2023
487442e
ah: emit event when historic prices are set
eladmallel Sep 27, 2023
b58087e
add natspec
eladmallel Sep 27, 2023
b2075f4
quick POC of excess eth burn in treasury
eladmallel Sep 27, 2023
9332b22
use a better rETH oracle function
eladmallel Sep 28, 2023
f6c02e4
format fix
eladmallel Sep 28, 2023
385ec99
ah: add setTimeBuffer successful test
eladmallel Sep 28, 2023
ae7cf9e
ah: change array params to calldata
eladmallel Sep 28, 2023
eed1cfd
ah: remove the feature of setting historic prices
eladmallel Sep 28, 2023
b098f5f
Merge branch 'verbs-auctionv2-infinite-oracle' into verbs-spend-or-bu…
eladmallel Sep 28, 2023
f0e978b
fix format
eladmallel Sep 28, 2023
46fcf46
second iteration on the burn
eladmallel Sep 28, 2023
0f61bc2
fix natspec
eladmallel Sep 28, 2023
44f4b3b
excesseth: simplify
eladmallel Sep 28, 2023
7108a07
burn: add waiting period timestamp
eladmallel Sep 28, 2023
083d21a
revert if no excess eth and burn is called
eladmallel Sep 28, 2023
0042e7d
burn: started testing ExcessETH
eladmallel Sep 28, 2023
16981af
burn: handle expectedValue > current
eladmallel Sep 28, 2023
f834827
add excess eth test
eladmallel Sep 28, 2023
f1a18fd
minor refactor and some natspec
eladmallel Sep 29, 2023
6be9a90
cleanup
eladmallel Sep 29, 2023
e322863
add tests
eladmallel Sep 29, 2023
504590d
add tests
eladmallel Sep 29, 2023
caa551d
add test for insufficient auction history
eladmallel Sep 29, 2023
8bf4e5c
add min past auction count constraint
eladmallel Sep 29, 2023
6ab1a8e
add natspec
eladmallel Sep 29, 2023
da51dcb
add tests for treasury v3 burn
eladmallel Sep 29, 2023
4d43645
add WIP excess burn test with treasury upgrade
eladmallel Sep 29, 2023
91ceaf4
complete treasury upgrade and burn happy flow test
eladmallel Sep 29, 2023
23adadb
fix CR comments
eladmallel Oct 2, 2023
46b571b
burn: update to burn every N noun mints
eladmallel Oct 2, 2023
0429ca4
ah: more bit packing to save gas
eladmallel Oct 3, 2023
a62537a
rewrite AHV2 logic deployment using foundry
eladmallel Oct 3, 2023
d567ca1
ah: add the setPrices owner function again
eladmallel Oct 3, 2023
4d68410
Merge branch 'verbs-auctionv2-infinite-oracle' into verbs-spend-or-bu…
eladmallel Oct 3, 2023
7da6435
excessETH: use new AH V2 interface
eladmallel Oct 3, 2023
d5b76f5
testnet: scripts and config to test the burn on sepolia
eladmallel Oct 3, 2023
3bf4c06
add auction house gas snapshots
davidbrai Oct 4, 2023
936eda9
change AH getter to return struct
davidbrai Oct 5, 2023
8553c80
change var to public
davidbrai Oct 5, 2023
f2ee3b5
Merge remote-tracking branch 'origin/verbs-auctionv2-infinite-oracle'…
davidbrai Oct 5, 2023
f677583
AH2: add auction and prices to interface
davidbrai Oct 5, 2023
3fb3f1e
Merge remote-tracking branch 'origin/verbs-auctionv2-infinite-oracle'…
davidbrai Oct 5, 2023
ff650bc
ah2: minor rename
davidbrai Oct 5, 2023
05eb47a
bugfix: fix bug returning empty settlements
davidbrai Oct 5, 2023
79f611a
AH2: use error strings instead of custom errors
davidbrai Oct 5, 2023
a62b08d
ah2: rename storage vars to reduce diff compared to AHv1
davidbrai Oct 5, 2023
5039ef1
Merge remote-tracking branch 'origin/verbs-auctionv2-infinite-oracle'…
davidbrai Oct 5, 2023
3b1256c
fix test post merge
davidbrai Oct 5, 2023
3f76636
add natspec
davidbrai Oct 6, 2023
6726f23
minor: rename test
davidbrai Oct 6, 2023
1e98e14
ah2: gas shavings
davidbrai Oct 6, 2023
3b7e1ee
ah2: gas optimize prices functions
davidbrai Oct 6, 2023
3b536b0
noracle: add function to return only prices
davidbrai Oct 6, 2023
44ef0b9
Merge remote-tracking branch 'origin/verbs-auctionv2-infinite-oracle'…
davidbrai Oct 6, 2023
23b84ba
burn: use new getPrices function from auction house
davidbrai Oct 6, 2023
110d7c3
cleanup
davidbrai Oct 6, 2023
cf7db77
cleanups
davidbrai Oct 6, 2023
cd2d8f6
cleanup
davidbrai Oct 6, 2023
d385b0f
add burn upgrade mainnet fork test
davidbrai Oct 9, 2023
e9f7200
burner: add protection in case auction house returns an invalid noun id
davidbrai Oct 10, 2023
d1c4c84
cleanup
davidbrai Oct 10, 2023
7e6ff8c
add docs
davidbrai Oct 10, 2023
e82bb20
burner: add event
davidbrai Oct 10, 2023
a1d52a2
add natspec
davidbrai Oct 10, 2023
30cd0bb
Merge remote-tracking branch 'origin/verbs-auctionv2-infinite-oracle'…
davidbrai Oct 10, 2023
ee6c04a
tests: update V3 tests to use upgraded auction house
davidbrai Oct 10, 2023
5da5eff
natspec
davidbrai Oct 10, 2023
ea002b5
minor renames in burner contract
davidbrai Oct 11, 2023
0edf915
ah: revert custom paused bool
eladmallel Oct 11, 2023
c25cdc2
Merge branch 'verbs-auctionv2-infinite-oracle' into verbs-spend-or-bu…
eladmallel Oct 11, 2023
f15ea48
burn: change times when burn is possible to use burn windows
davidbrai Oct 13, 2023
5d1bea6
gas: optimize storage warmup function
davidbrai Oct 19, 2023
3c7725f
Merge remote-tracking branch 'origin/master' into verbs-spend-or-burn…
davidbrai Oct 25, 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
35 changes: 24 additions & 11 deletions packages/nouns-contracts/.gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
NounsDAOLogic_GasSnapshot_V2_propose:test_propose_longDescription() (gas: 528733)
NounsDAOLogic_GasSnapshot_V2_propose:test_propose_shortDescription() (gas: 398388)
NounsDAOLogic_GasSnapshot_V2_vote:test_castVoteWithReason() (gas: 83474)
NounsDAOLogic_GasSnapshot_V2_vote:test_castVote_against() (gas: 82886)
NounsDAOLogic_GasSnapshot_V2_vote:test_castVote_lastMinuteFor() (gas: 83459)
NounsDAOLogic_GasSnapshot_V3_propose:test_propose_longDescription() (gas: 538195)
NounsDAOLogic_GasSnapshot_V3_propose:test_propose_shortDescription() (gas: 404029)
NounsDAOLogic_GasSnapshot_V3_vote:test_castVoteWithReason() (gas: 89809)
NounsDAOLogic_GasSnapshot_V3_vote:test_castVote_against() (gas: 88733)
NounsDAOLogic_GasSnapshot_V3_vote:test_castVote_lastMinuteFor() (gas: 112249)
NounsDAOLogic_GasSnapshot_V3_voteDuringObjectionPeriod:test_castVote_duringObjectionPeriod_against() (gas: 88656)
NounsAuctionHouseV2WarmedUp_GasSnapshot:test_createOneBid() (gas: 34963)
NounsAuctionHouseV2WarmedUp_GasSnapshot:test_createTwoBids() (gas: 93423)
NounsAuctionHouseV2WarmedUp_GasSnapshot:test_settleCurrentAndCreateNewAuction() (gas: 232686)
NounsAuctionHouseV2_GasSnapshot:test_createOneBid() (gas: 34963)
NounsAuctionHouseV2_GasSnapshot:test_createTwoBids() (gas: 93423)
NounsAuctionHouseV2_GasSnapshot:test_settleCurrentAndCreateNewAuction() (gas: 249786)
NounsAuctionHouseV2_HistoricPrices_GasSnapshot:test_getPrices_90() (gas: 310063)
NounsAuctionHouseV2_HistoricPrices_GasSnapshot:test_getPrices_range_90() (gas: 300578)
NounsAuctionHouseV2_HistoricPrices_GasSnapshot:test_getSettlements_90() (gas: 385762)
NounsAuctionHouseV2_HistoricPrices_GasSnapshot:test_getSettlements_range_90() (gas: 378168)
NounsAuctionHouse_GasSnapshot:test_createOneBid() (gas: 81474)
NounsAuctionHouse_GasSnapshot:test_createTwoBids() (gas: 142736)
NounsAuctionHouse_GasSnapshot:test_settleCurrentAndCreateNewAuction() (gas: 243008)
NounsDAOLogic_GasSnapshot_V2_propose:test_propose_longDescription() (gas: 528754)
NounsDAOLogic_GasSnapshot_V2_propose:test_propose_shortDescription() (gas: 398387)
NounsDAOLogic_GasSnapshot_V2_vote:test_castVoteWithReason() (gas: 83585)
NounsDAOLogic_GasSnapshot_V2_vote:test_castVote_against() (gas: 82930)
NounsDAOLogic_GasSnapshot_V2_vote:test_castVote_lastMinuteFor() (gas: 83481)
NounsDAOLogic_GasSnapshot_V3_propose:test_propose_longDescription() (gas: 538397)
NounsDAOLogic_GasSnapshot_V3_propose:test_propose_shortDescription() (gas: 404209)
NounsDAOLogic_GasSnapshot_V3_vote:test_castVoteWithReason() (gas: 89882)
NounsDAOLogic_GasSnapshot_V3_vote:test_castVote_against() (gas: 88717)
NounsDAOLogic_GasSnapshot_V3_vote:test_castVote_lastMinuteFor() (gas: 112210)
NounsDAOLogic_GasSnapshot_V3_voteDuringObjectionPeriod:test_castVote_duringObjectionPeriod_against() (gas: 88702)
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// SPDX-License-Identifier: GPL-3.0

/// @title An interim contract for storage migration between V1 and V2

/*********************************
* ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *
* ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *
* ░░░░░░█████████░░█████████░░░ *
* ░░░░░░██░░░████░░██░░░████░░░ *
* ░░██████░░░████████░░░████░░░ *
* ░░██░░██░░░████░░██░░░████░░░ *
* ░░██░░██░░░████░░██░░░████░░░ *
* ░░░░░░█████████░░█████████░░░ *
* ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *
* ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *
*********************************/

pragma solidity ^0.8.19;

import { PausableUpgradeable } from '@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol';
import { ReentrancyGuardUpgradeable } from '@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol';
import { OwnableUpgradeable } from '@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol';
import { INounsAuctionHouse } from './interfaces/INounsAuctionHouse.sol';
import { INounsAuctionHouseV2 } from './interfaces/INounsAuctionHouseV2.sol';

contract NounsAuctionHousePreV2Migration is PausableUpgradeable, ReentrancyGuardUpgradeable, OwnableUpgradeable {
struct OldLayout {
address nouns;
address weth;
uint256 timeBuffer;
uint256 reservePrice;
uint8 minBidIncrementPercentage;
uint256 duration;
INounsAuctionHouse.Auction auction;
}

struct NewLayout {
uint192 reservePrice;
uint56 timeBuffer;
uint8 minBidIncrementPercentage;
INounsAuctionHouseV2.AuctionV2 auction;
bool paused;
}

uint256 private startSlot;

function migrate() public onlyOwner {
OldLayout storage oldLayout = _oldLayout();
NewLayout storage newLayout = _newLayout();
OldLayout memory oldLayoutCache = oldLayout;

// Clear the old storage layout
oldLayout.nouns = address(0);
oldLayout.weth = address(0);
oldLayout.timeBuffer = 0;
oldLayout.reservePrice = 0;
oldLayout.minBidIncrementPercentage = 0;
oldLayout.duration = 0;
oldLayout.auction = INounsAuctionHouse.Auction(0, 0, 0, 0, payable(0), false);

// Populate the new layout from the cache
newLayout.reservePrice = uint192(oldLayoutCache.reservePrice);
newLayout.timeBuffer = uint56(oldLayoutCache.timeBuffer);
newLayout.minBidIncrementPercentage = oldLayoutCache.minBidIncrementPercentage;
newLayout.auction = INounsAuctionHouseV2.AuctionV2({
nounId: uint128(oldLayoutCache.auction.nounId),
amount: uint128(oldLayoutCache.auction.amount),
startTime: uint40(oldLayoutCache.auction.startTime),
endTime: uint40(oldLayoutCache.auction.endTime),
bidder: oldLayoutCache.auction.bidder,
settled: oldLayoutCache.auction.settled
});
newLayout.paused = paused();
}

function _oldLayout() internal pure returns (OldLayout storage layout) {
assembly {
layout.slot := startSlot.slot
}
}

function _newLayout() internal pure returns (NewLayout storage layout) {
assembly {
layout.slot := startSlot.slot
}
}
}
Loading
Loading