Skip to content

Commit

Permalink
More events added
Browse files Browse the repository at this point in the history
  • Loading branch information
mobycrypt committed Oct 30, 2023
1 parent a62678e commit ccc0488
Show file tree
Hide file tree
Showing 5 changed files with 10,238 additions and 5,491 deletions.
5 changes: 5 additions & 0 deletions contracts/Proposal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ contract Proposal is ReentrancyGuard {

event ChallengePeriodExtended(uint256 extendChallengePeriodSeconds);
event Voted(address voter, bool voteSide, uint256 votesCount, bool isTokenVote);
event Executed(address executor);
event RewardClaimed(address claimer, uint256 reward);

constructor(
bytes32 _proposalMerkleRootHex,
Expand Down Expand Up @@ -59,6 +61,7 @@ contract Proposal is ReentrancyGuard {
PollCard storage pollCard = votes[_sequencerAddress];
pollCard.nativeForVotes = votesCount;
forVotesCounter = votesCount;
emit Voted(_sequencerAddress, true, votesCount, false);
}

function vote(bool voteSide) public payable isInChallengePeriodMod {
Expand Down Expand Up @@ -121,6 +124,7 @@ contract Proposal is ReentrancyGuard {
}
delete votes[msg.sender];
payable(msg.sender).transfer(reward);
emit RewardClaimed(msg.sender, reward);
}

function executeProposal() public payable isAfterChallengePeriodMod nonReentrant {
Expand All @@ -138,6 +142,7 @@ contract Proposal is ReentrancyGuard {
delete votes[sequencerAddress];
payable(sequencerAddress).transfer(pollCard.nativeForVotes * nativeCollateral);
}
emit Executed(msg.sender);
}

// This eliminates the racing - voting in last hour extends the challenge period for "extendChallengePeriodSeconds" seconds
Expand Down
14 changes: 11 additions & 3 deletions contracts/dao/Dao.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,17 @@ abstract contract Dao is ReentrancyGuard, IERC721Receiver {
uint256 public nativeCollateral;
uint256 public extendChallengePeriodSeconds;

event ProposalCreated(bytes proposalId, address proposalAddress);
event ProposalCreated(
bytes proposalId,
address proposalAddress,
bytes32 _proposalMerkleRootHex,
address payable _sequencerAddress,
uint256 _nativeCollateral,
uint256 _tokenCollateral,
uint256 _challengePeriodSeconds,
bytes[] _payloads,
uint256 _extendChallengePeriodSeconds);
event DaoPoolCreated(address daoPoolAddress);

function getDaoPool() internal virtual returns (DaoPool);

// _tokenCollateral - should already include decimals
Expand Down Expand Up @@ -47,7 +55,7 @@ abstract contract Dao is ReentrancyGuard, IERC721Receiver {
);
proposals[_proposalId] = proposal;
getDaoPool().approveProposal(address(proposal));
emit ProposalCreated(_proposalId, address(proposal));
emit ProposalCreated(_proposalId, address(proposal), _proposalMerkleRoot, payable(msg.sender), nativeCollateral, tokenCollateral, challengePeriodSeconds, _payloads, extendChallengePeriodSeconds);
}

function sendErc20(bytes memory proposalId, address tokenAddress, address to, uint256 amount) external {
Expand Down
Loading

0 comments on commit ccc0488

Please sign in to comment.