Skip to content

Commit

Permalink
Updated storage for contract upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
MSalman6 committed Oct 29, 2024
1 parent 62c064f commit b819fcb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
12 changes: 8 additions & 4 deletions contracts/DiamondDao.sol
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ contract DiamondDao is IDiamondDao, Initializable, ReentrancyGuardUpgradeable, V
/// @dev To keep track of the last DAO phase count for unfinalized proposals check
uint256 public lastDaoPhaseCount;

/// @dev To keep track of proposal creation fee
mapping(uint256 => uint256) public proposalFee;

modifier exists(uint256 proposalId) {
if (!proposalExists(proposalId)) {
revert ProposalNotExist(proposalId);
Expand Down Expand Up @@ -278,13 +281,14 @@ contract DiamondDao is IDiamondDao, Initializable, ReentrancyGuardUpgradeable, V
proposal.description = description;
proposal.discussionUrl = discussionUrl;
proposal.daoPhaseCount = daoPhaseCount;
proposal.proposalFee = createProposalFee;
proposal.proposalType = proposalType;

currentPhaseProposals.push(proposalId);
statistic.total += 1;
unfinalizedProposals += 1;

proposalFee[proposalId] = createProposalFee;

emit ProposalCreated(proposer, proposalId, targets, values, calldatas, title, description, discussionUrl, createProposalFee);
}

Expand Down Expand Up @@ -344,12 +348,12 @@ contract DiamondDao is IDiamondDao, Initializable, ReentrancyGuardUpgradeable, V
statistic.accepted += 1;

// return fee back to the proposer
_transfer(proposal.proposer, proposal.proposalFee);
_transfer(proposal.proposer, proposalFee[proposalId]);
} else {
statistic.declined += 1;

// send fee to the reinsert pot
_transfer(reinsertPot, proposal.proposalFee);
_transfer(reinsertPot, proposalFee[proposalId]);
}

unfinalizedProposals -= 1;
Expand Down Expand Up @@ -655,4 +659,4 @@ contract DiamondDao is IDiamondDao, Initializable, ReentrancyGuardUpgradeable, V
function _getTotalStakedAmount() private view returns (uint256) {
return stakingHbbft.totalStakedAmount();
}
}
}
1 change: 0 additions & 1 deletion contracts/library/DaoStructs.sol
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ struct Proposal {
string description;
string discussionUrl;
uint256 daoPhaseCount;
uint256 proposalFee;
ProposalType proposalType;
}

Expand Down
1 change: 0 additions & 1 deletion test/DiamondDao.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,6 @@ describe("DiamondDao contract", function () {
description,
"url",
1, // first phase
createProposalFee,
0 // open proposal
]);
});
Expand Down

0 comments on commit b819fcb

Please sign in to comment.