diff --git a/contracts/dao/CandidateAddOnV1_1.sol b/contracts/dao/CandidateAddOnV1_1.sol index dc0126d..341d952 100644 --- a/contracts/dao/CandidateAddOnV1_1.sol +++ b/contracts/dao/CandidateAddOnV1_1.sol @@ -135,6 +135,7 @@ contract CandidateAddOnV1_1 is /// @notice Call updateSeigniorage on SeigManager /// @param afterCall After running the update seigniorage, the option to run additional functions /// 0: none, 1: claim, 2: staking + /// @param flagTON If it is true, claim with ton, otherwise claim with wton /// @return Whether or not the execution succeeded function updateSeigniorage(uint256 afterCall, bool flagTON) public returns (bool) { diff --git a/contracts/layer2/LegacySystemConfig.sol b/contracts/layer2/LegacySystemConfig.sol index c2d93e2..a350d84 100644 --- a/contracts/layer2/LegacySystemConfig.sol +++ b/contracts/layer2/LegacySystemConfig.sol @@ -3,25 +3,10 @@ pragma solidity ^0.8.4; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; +import "./LegacySystemConfigStorage.sol"; -contract LegacySystemConfig is Ownable { - - /// @notice Struct representing the addresses of L1 system contracts. These should be the - /// proxies and will differ for each OP Stack chain. - struct Addresses { - address l1CrossDomainMessenger; - address l1ERC721Bridge; - address l1StandardBridge; - address l2OutputOracle; - address optimismPortal; - address optimismMintableERC20Factory; - } - - Addresses public addresses; - // address public l2Ton; - string public name; - address public l1BridgeRegistry; +contract LegacySystemConfig is Ownable, LegacySystemConfigStorage { /* ========== CONSTRUCTOR ========== */ constructor() { diff --git a/deploy-staking-v2.5-mainnet/0.deploy.ts b/deploy-staking-v2.5-mainnet/0.deploy.ts index 1f60e25..41bbab1 100644 --- a/deploy-staking-v2.5-mainnet/0.deploy.ts +++ b/deploy-staking-v2.5-mainnet/0.deploy.ts @@ -20,6 +20,7 @@ import { SeigManagerV1_3 } from "../typechain-types/contracts/stake/managers/Sei import { DepositManagerV1_1 } from "../typechain-types/contracts/stake/managers/DepositManagerV1_1.sol" import { LegacySystemConfig } from "../typechain-types/contracts/layer2/LegacySystemConfig" +import { LegacySystemConfigProxy } from "../typechain-types/contracts/layer2/LegacySystemConfigProxy" import {Signer} from "ethers" @@ -50,6 +51,7 @@ const deployV2Mainnet: DeployFunction = async function (hre: HardhatRuntimeEnvir owner: DAOCommitteeProxy }, Titan : { + proxyOwner: DAOCommitteeProxy, manager: "0x340C44089bc45F86060922d2d89eFee9e0CDF5c7" } } @@ -70,25 +72,6 @@ const deployV2Mainnet: DeployFunction = async function (hre: HardhatRuntimeEnvir console.log("addresses: ", addresses) - // return; - - console.log("\n=== ownerAddressInfo ===" ) - console.log(ownerAddressInfo) - - const name = 'Titan' - const addresses = { - l1CrossDomainMessenger: l1MessengerAddress, - l1ERC721Bridge: hre.ethers.constants.AddressZero, - l1StandardBridge: l1BridgeAddress, - l2OutputOracle: hre.ethers.constants.AddressZero, - optimismPortal: hre.ethers.constants.AddressZero, - optimismMintableERC20Factory: hre.ethers.constants.AddressZero - } - console.log("\n === Titan Candidate ===" ) - console.log("name: ", name) - console.log("addresses: ", addresses) - - // return; const { deploy } = hre.deployments; @@ -309,25 +292,46 @@ const deployV2Mainnet: DeployFunction = async function (hre: HardhatRuntimeEnvir }); //==== LegacySystemConfig ================================= - const LegacySystemConfig = await deploy("LegacySystemConfig", { + const LegacySystemConfigDep = await deploy("LegacySystemConfig", { + from: deployer, + args: [], + log: true + }); + + const LegacySystemConfigProxyDep = await deploy("LegacySystemConfigProxy", { from: deployer, args: [], log: true }); + const LegacySystemConfigProxy = (await hre.ethers.getContractAt( + LegacySystemConfigProxyDep.abi, + LegacySystemConfigProxyDep.address + )) as LegacySystemConfigProxy; + const legacySystemConfig = (await hre.ethers.getContractAt( - LegacySystemConfig.abi, - LegacySystemConfig.address + LegacySystemConfigDep.abi, + LegacySystemConfigProxyDep.address )) as LegacySystemConfig; + + await (await LegacySystemConfigProxy.connect(deploySigner).upgradeTo( + LegacySystemConfigDep.address + )).wait() + await (await legacySystemConfig.connect(deploySigner).setAddresses( name, addresses, l1BridgeRegistryProxy.address )).wait() - await (await legacySystemConfig.connect(deploySigner).transferOwnership( - ownerAddressInfo.Titan.manager + console.log('ownerAddressInfo.Titan.proxyOwner', ownerAddressInfo.Titan.proxyOwner) + await (await LegacySystemConfigProxy.connect(deploySigner).transferProxyOwnership( + ownerAddressInfo.Titan.proxyOwner )).wait() + console.log('ownerAddressInfo.Titan.manager', ownerAddressInfo.Titan.manager) + await (await LegacySystemConfigProxy.connect(deploySigner).transferOwnership( + ownerAddressInfo.Titan.manager + )).wait() //======= TransferOwner to DAOCommittee ====================================== diff --git a/test/layer2/units/7.dao-staking-v2.5.mainnet.test.ts b/test/layer2/units/7.dao-staking-v2.5.mainnet.test.ts index 5c66001..b574971 100644 --- a/test/layer2/units/7.dao-staking-v2.5.mainnet.test.ts +++ b/test/layer2/units/7.dao-staking-v2.5.mainnet.test.ts @@ -92,7 +92,8 @@ let ownerAddressInfo = { owner: "0xDD9f0cCc044B0781289Ee318e5971b0139602C26" }, Titan : { - MultiProposerableTransactionExecutor: "0x014E38eAA7C9B33FeF08661F8F0bFC6FE43f1496" + proxyOwner: "0xDD9f0cCc044B0781289Ee318e5971b0139602C26", + manager: "0x340C44089bc45F86060922d2d89eFee9e0CDF5c7" } } @@ -237,14 +238,15 @@ describe('Layer2Manager', () => { seigniorageCommittee = await hre.ethers.getSigner(seigniorageCommitteeAddress); await hre.network.provider.send("hardhat_impersonateAccount", [ - ownerAddressInfo.Titan.MultiProposerableTransactionExecutor, + ownerAddressInfo.Titan.manager, ]); await hre.network.provider.send("hardhat_setBalance", [ - ownerAddressInfo.Titan.MultiProposerableTransactionExecutor, + ownerAddressInfo.Titan.manager, "0x10000000000000000000000000", ]); - titanManager = await hre.ethers.getSigner(ownerAddressInfo.Titan.MultiProposerableTransactionExecutor); + titanManager = await hre.ethers.getSigner(ownerAddressInfo.Titan.manager); + tonMinter = daoAdmin }) describe('# Tester', () => { @@ -252,6 +254,9 @@ describe('Layer2Manager', () => { await (await tonContract.connect(daoAdmin).mint(addr1.address, ethers.utils.parseEther("2000"))).wait() await (await tonContract.connect(daoAdmin).mint(addr2.address, ethers.utils.parseEther("2000"))).wait() + await (await tonContract.connect(tonMinter).mint(tonHave.address, ethers.utils.parseEther("2000"))).wait() + await (await tonContract.connect(tonMinter).mint(pastAddr, ethers.utils.parseEther("2000"))).wait() + await (await wtonContract.connect(tonMinter).mint(wtonHave.address, ethers.utils.parseEther("3000000000000"))).wait() }) }) @@ -274,7 +279,7 @@ describe('Layer2Manager', () => { daoCommitteeProxy2Contract = (await ethers.getContractAt("DAOCommitteeProxy2", deployed.DAOCommitteeProxy2.address, deployer)) as DAOCommitteeProxy2; daoCommitteeOwner = (await ethers.getContractAt("DAOCommitteeOwner", deployed.DAOCommitteeOwner.address, deployer)) as DAOCommitteeOwner; daoCommittee_V1 = (await ethers.getContractAt("DAOCommittee_V1", deployed.DAOCommittee_V1.address, deployer)) as DAOCommittee_V1; - legacySystemConfig = (await ethers.getContractAt("LegacySystemConfig", deployed.LegacySystemConfig.address, deployer )) as LegacySystemConfig; + legacySystemConfig = (await ethers.getContractAt("LegacySystemConfig", deployed.LegacySystemConfigProxy.address, deployer )) as LegacySystemConfig; // console.log('l1BridgeRegistryProxy', l1BridgeRegistryProxy.address) // console.log('l1BridgeRegistry', l1BridgeRegistry.address) @@ -1175,6 +1180,7 @@ describe('Layer2Manager', () => { const prevWtonBalanceOfLayer2Manager = await wtonContract.balanceOf(layer2Manager.address) const prevWtonBalanceOfLayer2Operator = await wtonContract.balanceOf(titanOperatorContractAddress) const prevWtonBalanceOfManager = await wtonContract.balanceOf(titanManager.address) + const prevUnSettledReward = await seigManager.unSettledReward(titanLayerAddress) expect(prevWtonBalanceOfLayer2Manager).to.be.gte(prevUnSettledReward) @@ -1243,7 +1249,7 @@ describe('Layer2Manager', () => { const topic1 = seigManager.interface.getEventTopic('SeigGiven2'); const log1 = receipt.logs.find(x => x.topics.indexOf(topic1) >= 0); const deployedEvent1 = seigManager.interface.parseLog(log1); - // console.log(deployedEvent1.args) + console.log(deployedEvent1.args) expect(estimatedDistribute.maxSeig).to.be.eq(deployedEvent1.args.totalSeig) expect(estimatedDistribute.stakedSeig).to.be.eq(deployedEvent1.args.stakedSeig) @@ -1280,7 +1286,7 @@ describe('Layer2Manager', () => { ) expect(afterWtonBalanceOfLayer2Operator).to.be.eq(ethers.constants.Zero) - expect(afterWtonBalanceOfManager).to.be.eq(prevWtonBalanceOfLayer2Operator.add(estimatedDistribute.layer2Seigs)) + expect(afterWtonBalanceOfManager).to.be.eq(prevWtonBalanceOfManager.add(prevWtonBalanceOfLayer2Operator).add(estimatedDistribute.layer2Seigs)) })