diff --git a/addresses/1.json b/addresses/1.json index a0985d4..87e467d 100644 --- a/addresses/1.json +++ b/addresses/1.json @@ -1,4 +1,6 @@ { + "BuilderDAO": "0x7498e6e471f31e869f038D8DBffbDFdf650c3F95", + "ProtocolRewards": "0x7777777F279eba3d3Ad8F4E708545291A6fDBA8B", "Manager": "0xd310a3041dfcf14def5ccbc508668974b5da7174", "ManagerImpl": "0x138D8Aef5Cbbbb9Ea8da98CC0847FE0F3b573b40", "WETH": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", diff --git a/addresses/420.json b/addresses/420.json index 51d8a70..9363fbc 100644 --- a/addresses/420.json +++ b/addresses/420.json @@ -1,4 +1,7 @@ { + "BuilderDAO": "0x7498e6e471f31e869f038D8DBffbDFdf650c3F95", + "ProtocolRewards": "0x7777777F279eba3d3Ad8F4E708545291A6fDBA8B", + "CrossDomainMessenger": "0x4200000000000000000000000000000000000007", "Manager": "0x5f9c1e7e31875beaa6ba6b0ab573a4abecc95d67", "ManagerImpl": "0x93f9d43a7bd751f8546a54785ae48d049ddd2697", "WETH": "0x4200000000000000000000000000000000000006", diff --git a/addresses/84531.json b/addresses/84531.json index 9a6b22a..3f908ee 100644 --- a/addresses/84531.json +++ b/addresses/84531.json @@ -3,13 +3,11 @@ "WETH": "0x4200000000000000000000000000000000000006", "CrossDomainMessenger": "0x4200000000000000000000000000000000000007", "ProtocolRewards": "0x7777777F279eba3d3Ad8F4E708545291A6fDBA8B", - "Manager": "0xcce64c2b4c51c2894fe5df0dda3e34e4d850b699", - "ManagerImpl": "0x2474f9cbaf0d44192eeb28bd2f0646832f69b3e9", - "Auction": "0x4220f838ff74091c89118e815675116a0b9c3bb1", - "Token": "0xea48534d98dbf46cee0456f14f6bc4ac3bb8c101", - "MetadataRenderer": "0xf81bbb4d924496c4976f745fc758cf54d0496777", - "Treasury": "0x76aa112e12d6ad7cbc7cf40be254f279b73abfae", - "Governor": "0xe6eed6d0cad0af9e611c026c32b38c177db28f61", - "MerkleReserveMinter": "0xa2d7e55f87f1913d5da10807cf695dc35bc29b12", - "MigrationDeployer": "0xed98171590dba48f6596f4743c2b7300a7091f9e" + "Manager": "0x550c326d688fD51ae65AC6A2d48749E631023A03", + "ManagerImpl": "0xA644bA2dD0740ACD6FE6f9a031C6b7B2Ce466299", + "Auction": "0x3fb5d8E80835D07056c12757A183Ab659B1a44BF", + "Token": "0x3CC6ba057f394B00aC1fF48707d5C04DE29504C6", + "MetadataRenderer": "0x0B3a22E5C5824d9d227986F76190f504c0906aD6", + "Treasury": "0x047B1E00EB4726aFc57d559f851146e84E31d1dC", + "Governor": "0x2EFf3083Bff979C349C59C14cE3945AfEA023927" } diff --git a/addresses/999.json b/addresses/999.json index 466267b..9c84c72 100644 --- a/addresses/999.json +++ b/addresses/999.json @@ -1,4 +1,7 @@ { + "BuilderDAO": "0x7498e6e471f31e869f038D8DBffbDFdf650c3F95", + "ProtocolRewards": "0x7777777F279eba3d3Ad8F4E708545291A6fDBA8B", + "CrossDomainMessenger": "0x4200000000000000000000000000000000000007", "Manager": "0xc521f85613985b7e417fccd5b348f64263d79397", "ManagerImpl": "0x50704311b9732bf7dd7d892859c4a60f752e736b", "WETH": "0x4200000000000000000000000000000000000006", diff --git a/deploys/420.version2_new.txt b/deploys/420.version2_new.txt new file mode 100644 index 0000000..1c1fb74 --- /dev/null +++ b/deploys/420.version2_new.txt @@ -0,0 +1,2 @@ +Merkle Reserve Minter: 0x397f575356d25c8a2b255360507a80024ed64938 +Migration Deployer: 0x07ade0c8adaa0cf6f68a6772db12818922729f70 diff --git a/deploys/420.version2_upgrade.txt b/deploys/420.version2_upgrade.txt new file mode 100644 index 0000000..9de9b3a --- /dev/null +++ b/deploys/420.version2_upgrade.txt @@ -0,0 +1,4 @@ +Token implementation: 0xef49483419bc5516ec4c6d601adfac4a359ef8a6 +Auction implementation: 0xdd908dfaf5e13bac01abe96e4b6d992f92c1fca0 +Governor implementation: 0xef36580d07a0649e616d8dff968762ec703e12bb +Manager implementation: 0x5f94ae9dca1d215331d627f38a721c6f3f7e9872 diff --git a/deploys/84531.version2_new.txt b/deploys/84531.version2_new.txt index d500c72..cfef3ea 100644 --- a/deploys/84531.version2_new.txt +++ b/deploys/84531.version2_new.txt @@ -1,2 +1,2 @@ -Merkle Reserve Minter: 0xa2d7e55f87f1913d5da10807cf695dc35bc29b12 -Migration Deployer: 0xed98171590dba48f6596f4743c2b7300a7091f9e +Merkle Reserve Minter: 0x088b9066b765d47e56d477d78bd0d5400aead99e +Migration Deployer: 0x3a4996be5586e55c165c7ce2666cee61ca0deebe diff --git a/deploys/84531.version2_upgrade.txt b/deploys/84531.version2_upgrade.txt new file mode 100644 index 0000000..ee2c0e8 --- /dev/null +++ b/deploys/84531.version2_upgrade.txt @@ -0,0 +1,4 @@ +Token implementation: 0x7c64ffb35304eac2255c82ed1f59336372488c88 +Auction implementation: 0x0a7d1e9d45f258f39721b23b53c856bac1326c3c +Governor implementation: 0x2586bf7af4d4857e703e02d56045b9d717cfb10c +Manager implementation: 0x94523d59e37c44bdf093f4adf2bcd4092e921a2d diff --git a/deploys/999.version2_new.txt b/deploys/999.version2_new.txt new file mode 100644 index 0000000..1697b15 --- /dev/null +++ b/deploys/999.version2_new.txt @@ -0,0 +1,2 @@ +Merkle Reserve Minter: 0x7a1857b438a05f08aed1dbe8138bb02bb1f01c4d +Migration Deployer: 0x76253481603b3411f94217fd086b0b5cc70da522 diff --git a/deploys/999.version2_upgrade.txt b/deploys/999.version2_upgrade.txt new file mode 100644 index 0000000..9f9ce87 --- /dev/null +++ b/deploys/999.version2_upgrade.txt @@ -0,0 +1,4 @@ +Token implementation: 0xAF80f93d2c4FE567959cd9d0C923f1c114cdef36. +Auction implementation: 0x7bc86F0a10Fb91c2f8e00264E1f2dD591b1Fd2C9. +Governor implementation: 0x359c7bC065acD51EB2b053a7a09F7C5274734BAe. +Manager implementation: 0x0B11E81948b528688d17B81E8F1E2c2B6C45f0e6. diff --git a/package.json b/package.json index 104aec3..ab8e816 100644 --- a/package.json +++ b/package.json @@ -41,8 +41,9 @@ "deploy:local": "source .env && forge script script/DeployContracts.s.sol:DeployContracts --private-key $PRIVATE_KEY --broadcast --rpc-url $RPC_URL", "deploy:v2-local": "source .env && forge script script/DeployContractsV2.s.sol:DeployContracts --private-key $PRIVATE_KEY --broadcast --rpc-url $RPC_URL", "deploy:v2-core": "source .env && forge script script/DeployV2Core.s.sol:DeployContracts --private-key $PRIVATE_KEY --rpc-url $RPC_URL --broadcast --verify --etherscan-api-key $ETHERSCAN_API_KEY", + "deploy:v2-upgrade": "source .env && forge script script/DeployV2Upgrade.s.sol:DeployContracts --private-key $PRIVATE_KEY --rpc-url $RPC_URL --resume --verify --etherscan-api-key $ETHERSCAN_API_KEY", "deploy:v2-new": "source .env && forge script script/DeployV2New.s.sol:DeployContracts --private-key $PRIVATE_KEY --rpc-url $RPC_URL --broadcast --verify --etherscan-api-key $ETHERSCAN_API_KEY", - "deploy:zora": "source .env && forge script script/DeployContracts.s.sol:DeployContracts --private-key $PRIVATE_KEY --rpc-url $RPC_URL --broadcast --verify --verifier blockscout --verifier-url https://explorer.zora.energy/api? -vvvv", + "deploy:zora": "source .env && forge script script/DeployV2New.s.sol:DeployContracts --private-key $PRIVATE_KEY --rpc-url $RPC_URL --broadcast --verify --verifier blockscout --verifier-url https://testnet.explorer.zora.energy/api? -vvvv", "test": "echo 'temporarily skipping metadata tests, remove this when fixed' && forge test --no-match-test 'WithAddress' -vvv", "typechain": "typechain --target=ethers-v5 'dist/artifacts/*/*.json' --out-dir dist/typechain", "storage-inspect:check": "./script/storage-check.sh check Manager Auction Governor Treasury Token", diff --git a/script/DeployV2Upgrade.s.sol b/script/DeployV2Upgrade.s.sol index 1365c84..d208314 100644 --- a/script/DeployV2Upgrade.s.sol +++ b/script/DeployV2Upgrade.s.sol @@ -24,15 +24,33 @@ contract DeployContracts is Script { function run() public { uint256 chainID = vm.envUint("CHAIN_ID"); - uint256 key = vm.envUint("PRIVATE_KEY"); address weth = vm.envAddress("WETH_ADDRESS"); configFile = vm.readFile(string.concat("./addresses/", Strings.toString(chainID), ".json")); - address deployerAddress = vm.addr(key); + address deployerAddress = vm.addr(vm.envUint("PRIVATE_KEY")); + address managerProxy = _getKey("Manager"); + address protocolRewards = _getKey("ProtocolRewards"); + address builderDAO = _getKey("BuilderDAO"); + address treasuryImpl = _getKey("Treasury"); + address metadataImpl = _getKey("MetadataRenderer"); - uint16 BUILDER_REWARDS = chainID == 1 || chainID == 5 ? 0 : 250; - uint16 REFERRAL_REWARDS = chainID == 1 || chainID == 5 ? 0 : 250; + _deployUpgrade(deployerAddress, managerProxy, protocolRewards, weth, metadataImpl, treasuryImpl, builderDAO, chainID); + } + + // workaround for stack too deep + function _deployUpgrade( + address deployerAddress, + address managerProxy, + address protocolRewards, + address weth, + address metadataImpl, + address treasuryImpl, + address builderDAO, + uint256 chainID + ) private { + uint16 builderRewardsValue = chainID == 1 || chainID == 5 ? 0 : 250; + uint16 referralRewardsValue = chainID == 1 || chainID == 5 ? 0 : 250; console2.log("~~~~~~~~~~ CHAIN ID ~~~~~~~~~~~"); console2.log(chainID); @@ -40,23 +58,41 @@ contract DeployContracts is Script { console2.log("~~~~~~~~~~ DEPLOYER ~~~~~~~~~~~"); console2.log(deployerAddress); - vm.startBroadcast(deployerAddress); + console2.log("~~~~~~~~~~ MANAGER PROXY ~~~~~~~~~~~"); + console2.logAddress(managerProxy); + + console2.log("~~~~~~~~~~ METADATA IMPL ~~~~~~~~~~~"); + console2.logAddress(metadataImpl); + + console2.log("~~~~~~~~~~ TREASURY IMPL ~~~~~~~~~~~"); + console2.logAddress(treasuryImpl); - address manager = _getKey("Manager"); + console2.log("~~~~~~~~~~ PROTOCOL REWARDS ~~~~~~~~~~~"); + console2.logAddress(protocolRewards); + + console2.log("~~~~~~~~~~ BUILDER DAO ~~~~~~~~~~~"); + console2.logAddress(builderDAO); + + console2.log("~~~~~~~~~~ BUILDER REWARDS VALUE ~~~~~~~~~~~"); + console2.logUint(builderRewardsValue); + + console2.log("~~~~~~~~~~ REFERRAL REWARDS VALUE ~~~~~~~~~~~"); + console2.logUint(referralRewardsValue); + console2.log(""); + + vm.startBroadcast(deployerAddress); // Deploy token implementation - address tokenImpl = address(new Token(manager)); + address tokenImpl = address(new Token(managerProxy)); // Deploy auction house implementation - address auctionImpl = address(new Auction(manager, _getKey("ProtocolRewards"), weth, BUILDER_REWARDS, REFERRAL_REWARDS)); + address auctionImpl = address(new Auction(managerProxy, protocolRewards, weth, builderRewardsValue, referralRewardsValue)); // Deploy governor implementation - address governorImpl = address(new Governor(manager)); + address governorImpl = address(new Governor(managerProxy)); // Deploy v2 manager implementation - address managerImpl = address( - new Manager(tokenImpl, _getKey("MetadataRenderer"), auctionImpl, _getKey("Treasury"), governorImpl, _getKey("BuilderDAO")) - ); + address managerImpl = address(new Manager(tokenImpl, metadataImpl, auctionImpl, treasuryImpl, governorImpl, builderDAO)); vm.stopBroadcast(); diff --git a/src/auction/Auction.sol b/src/auction/Auction.sol index 9feaaba..62b4217 100644 --- a/src/auction/Auction.sol +++ b/src/auction/Auction.sol @@ -35,6 +35,8 @@ contract Auction is IAuction, VersionedContract, UUPS, Ownable, ReentrancyGuard, /// @notice The maximum rewards percentage uint256 private constant MAX_FOUNDER_REWARD_BPS = 3_000; + bytes4 public constant REWARDS_REASON = bytes4(0x0B411DE6); + /// /// /// IMMUTABLES /// /// /// @@ -499,12 +501,14 @@ contract Auction is IAuction, VersionedContract, UUPS, Ownable, ReentrancyGuard, uint256 builderAmount = (_finalBidAmount * builderRewardsBPS) / BPS_PER_100_PERCENT; split.recipients[0] = builderRecipient; split.amounts[0] = builderAmount; + split.reasons[0] = REWARDS_REASON; split.totalRewards += builderAmount; // Set referral reward uint256 referralAmount = (_finalBidAmount * referralRewardsBPS) / BPS_PER_100_PERCENT; split.recipients[1] = _currentBidRefferal != address(0) ? _currentBidRefferal : builderRecipient; split.amounts[1] = referralAmount; + split.reasons[1] = REWARDS_REASON; split.totalRewards += referralAmount; // Set founder reward if enabled @@ -512,6 +516,7 @@ contract Auction is IAuction, VersionedContract, UUPS, Ownable, ReentrancyGuard, uint256 founderAmount = (_finalBidAmount * _founderRewardBps) / BPS_PER_100_PERCENT; split.recipients[2] = founderReward.recipient; split.amounts[2] = founderAmount; + split.reasons[2] = REWARDS_REASON; split.totalRewards += founderAmount; } }