Skip to content

Commit

Permalink
DPF-01
Browse files Browse the repository at this point in the history
  • Loading branch information
0xbeny committed May 21, 2024
1 parent 2baf69b commit 2b35480
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/contracts/src/DaofinPlugin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -662,10 +662,10 @@ contract DaofinPlugin is BaseDaofinPlugin {
}

function editProposalMetadata(uint256 _proposalId, bytes calldata _metadata) external {
(bool open, , address proposer, , , ) = getProposal(_proposalId);
(bool open, bool executed, address proposer, , , ) = getProposal(_proposalId);

// Proposal must be before election its attached election period.
if (!open) revert InValidTime();
if (open || executed) revert InValidTime();

// Only proposer address is able to modify metadata.
if (proposer != _msgSender()) revert InValidAddress();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ describe(PLUGIN_CONTRACT_NAME, function () {
[
BigNumber.from(now + 60 * 60 * 24 * 3),
BigNumber.from(now + 60 * 60 * 24 * 5),
BigNumber.from(now + 60 * 60 * 24 * 10),
BigNumber.from(now + 60 * 60 * 24 * 12),
],
[Bob.address],
'1',
Expand All @@ -131,7 +133,7 @@ describe(PLUGIN_CONTRACT_NAME, function () {
await daofinPlugin.joinHouse({value: parseEther('1')});
});
describe('Modify Proposal Metadata', async () => {
it('Modify proposal', async () => {
it('must not revert if it is before starting period', async () => {
createPropsalParams = createProposalParams(
'0x00',
[],
Expand All @@ -153,12 +155,12 @@ describe(PLUGIN_CONTRACT_NAME, function () {
);
await proposalTx.wait();

await expect(daofinPlugin.editProposalMetadata(proposalId, '0x01')).to
await expect(daofinPlugin.editProposalMetadata(proposalId, '0x01')).to.not
.reverted;

await advanceTime(ethers, convertDaysToSeconds(4));

await expect(daofinPlugin.editProposalMetadata(proposalId, '0x01')).to.not
await expect(daofinPlugin.editProposalMetadata(proposalId, '0x01')).to
.reverted;

const proposal = await daofinPlugin._proposals(proposalId);
Expand Down

0 comments on commit 2b35480

Please sign in to comment.