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 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 {} +} 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 - }); }); });