Skip to content

Commit

Permalink
Merge pull request #46 from julienbrg/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
julienbrg authored Dec 20, 2022
2 parents 740112b + 2f79ade commit ead432d
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 7 deletions.
4 changes: 1 addition & 3 deletions contracts/Gov.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions contracts/satellites/Hypercerts.sol
Original file line number Diff line number Diff line change
@@ -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 {}
}
File renamed without changes.
10 changes: 10 additions & 0 deletions contracts/satellites/Onboarding.sol
Original file line number Diff line number Diff line change
@@ -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 {}
}
18 changes: 18 additions & 0 deletions contracts/satellites/Vault.sol
Original file line number Diff line number Diff line change
@@ -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 {}
}
59 changes: 55 additions & 4 deletions test/Gov.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
});

Expand All @@ -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
});
});
});

0 comments on commit ead432d

Please sign in to comment.