From 7b3fd27d63e140a87f85f4112f2dd87554df2eda Mon Sep 17 00:00:00 2001 From: julienbrg Date: Tue, 20 Dec 2022 05:14:06 +0100 Subject: [PATCH 1/3] add satellites --- contracts/satellites/Hypercerts.sol | 10 ++++++++++ contracts/{ => satellites}/Manifesto.sol | 0 contracts/satellites/Onboarding.sol | 10 ++++++++++ contracts/satellites/Vault.sol | 18 ++++++++++++++++++ 4 files changed, 38 insertions(+) create mode 100644 contracts/satellites/Hypercerts.sol rename contracts/{ => satellites}/Manifesto.sol (100%) create mode 100644 contracts/satellites/Onboarding.sol create mode 100644 contracts/satellites/Vault.sol diff --git a/contracts/satellites/Hypercerts.sol b/contracts/satellites/Hypercerts.sol new file mode 100644 index 0000000..63a347b --- /dev/null +++ b/contracts/satellites/Hypercerts.sol @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity 0.8.17; + +import "@openzeppelin/contracts/access/Ownable.sol"; + +contract Hypercerts is Ownable { + constructor() {} + + receive() external payable {} +} diff --git a/contracts/Manifesto.sol b/contracts/satellites/Manifesto.sol similarity index 100% rename from contracts/Manifesto.sol rename to contracts/satellites/Manifesto.sol diff --git a/contracts/satellites/Onboarding.sol b/contracts/satellites/Onboarding.sol new file mode 100644 index 0000000..dd24a8b --- /dev/null +++ b/contracts/satellites/Onboarding.sol @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity 0.8.17; + +import "@openzeppelin/contracts/access/Ownable.sol"; + +contract Onboarding is Ownable { + constructor() {} + + receive() external payable {} +} diff --git a/contracts/satellites/Vault.sol b/contracts/satellites/Vault.sol new file mode 100644 index 0000000..138f5fb --- /dev/null +++ b/contracts/satellites/Vault.sol @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity 0.8.17; + +import "@openzeppelin/contracts/access/Ownable.sol"; + +contract Vault is Ownable { + constructor() {} + + function transferETH() public onlyOwner {} + + function transferERC20() public onlyOwner {} + + function transferERC721() public onlyOwner {} + + function transferERC1155() public onlyOwner {} + + receive() external payable {} +} From ef553749ffdd460569fc6b9394eaf4d46913b779 Mon Sep 17 00:00:00 2001 From: julienbrg Date: Tue, 20 Dec 2022 05:28:31 +0100 Subject: [PATCH 2/3] clean up --- contracts/Gov.sol | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/contracts/Gov.sol b/contracts/Gov.sol index bb14350..04a17c2 100644 --- a/contracts/Gov.sol +++ b/contracts/Gov.sol @@ -19,13 +19,11 @@ contract Gov is IVotes _token ) Governor("Gov") - GovernorSettings(1 /* 1 block */, 150 /* 30 minutes */, 1) + GovernorSettings(1, 150, 1) GovernorVotes(_token) GovernorVotesQuorumFraction(20) {} - // The following functions are overrides required by Solidity. - function votingDelay() public view From 2f79adea5ff9e030b6d893bf443bfc678368d816 Mon Sep 17 00:00:00 2001 From: julienbrg Date: Tue, 20 Dec 2022 05:28:48 +0100 Subject: [PATCH 3/3] fix upgrade gov --- test/Gov.ts | 59 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 4 deletions(-) diff --git a/test/Gov.ts b/test/Gov.ts index 99a18b4..cb69f66 100644 --- a/test/Gov.ts +++ b/test/Gov.ts @@ -235,6 +235,61 @@ describe("DAO Contracts", function () { }); + it("Should upgrade Gov", async function () { + const { nft, gov, alice, bob } = await loadFixture(deployContracts); + await nft.connect(alice).delegate(alice.address) + + const Gov = await ethers.getContractFactory("Gov"); + const gov2 = await Gov.deploy(await gov.token()) + + const call = await nft.interface.encodeFunctionData('transferOwnership', [gov2.address]) + const calldatas = [call.toString()] + + const PROPOSAL_DESCRIPTION = "" + const targets = [nft.address] + const values = ["0"] + const propose = await gov.connect(alice).propose( + targets, + values, + calldatas, + PROPOSAL_DESCRIPTION + ) + const proposeReceipt = await propose.wait(1) + const proposalId = proposeReceipt.events![0].args!.proposalId.toString() + await moveBlocks(2) + await gov.connect(alice).castVote(proposalId,1) + await gov.connect(bob).castVote(proposalId,1) + await moveBlocks(300) + const desc = ethers.utils.id(PROPOSAL_DESCRIPTION) + await gov.execute( + targets, + values, + calldatas, + desc + ) + + expect(await gov2.token()).to.equal(nft.address); + + }); + + xit("Should upgrade NFT", async function () { + const { nft, gov, alice, francis } = await loadFixture(deployContracts); + await nft.connect(alice).delegate(alice.address) + + const uri = "ipfs://bafkreih2ac5yabo2daerkw5w5wcwdc7rveqejf4l645hx2px26r5fxfnpe"; + + // replace by the current members + const firstMembers = [ + francis.address, + ]; + const NFT = await ethers.getContractFactory("NFT"); + const nft2 = await NFT.deploy(firstMembers, uri); + + // ... + + expect(await gov.token()).to.equal(nft2.address); + }); + xit("Should transfer ERC-20 to beneficiary", async function () { }); @@ -243,9 +298,5 @@ describe("DAO Contracts", function () { xit("Should transfer ERC-1155 to beneficiary", async function () { }); - - xit("Should upgrade to new implementation", async function () { - // Upgrade without UUPS - }); }); });