Skip to content

Commit

Permalink
fix upgrade gov
Browse files Browse the repository at this point in the history
  • Loading branch information
julienbrg committed Dec 20, 2022
1 parent ef55374 commit 2f79ade
Showing 1 changed file with 55 additions and 4 deletions.
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 2f79ade

Please sign in to comment.