Skip to content

Commit

Permalink
Add emit measurements sender (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangruber authored Sep 19, 2023
1 parent 587f5ef commit 88a5cca
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

## Events

### `MeasurementsAdded(string cid, uint roundIndex)`
### `MeasurementsAdded(string cid, uint roundIndex, address sender)`
### `RoundStart(uint roundIndex)`
### `Transfer(address indexed to, uint256 amount)`
### `TransferFailed(address indexed to, uint256 amount)`
Expand Down
4 changes: 2 additions & 2 deletions src/ImpactEvaluator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ contract ImpactEvaluator is AccessControl {
uint public roundReward = 100;
uint public maxStoredRounds = 1000;

event MeasurementsAdded(string cid, uint roundIndex);
event MeasurementsAdded(string cid, uint roundIndex, address sender);
event RoundStart(uint roundIndex);
event Transfer(address indexed to, uint256 amount);
event TransferFailed(address indexed to, uint256 amount);
Expand Down Expand Up @@ -80,7 +80,7 @@ contract ImpactEvaluator is AccessControl {
maybeAdvanceRound();
uint roundIndex = currentRoundIndex();
rounds[roundIndex].measurementsCids.push(cid);
emit MeasurementsAdded(cid, roundIndex);
emit MeasurementsAdded(cid, roundIndex, msg.sender);
return roundIndex;
}

Expand Down
4 changes: 2 additions & 2 deletions test/ImpactEvaluator.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import "../src/ImpactEvaluator.sol";

contract ImpactEvaluatorTest is Test {
event RoundStart(uint roundIndex);
event MeasurementsAdded(string cid, uint roundIndex);
event MeasurementsAdded(string cid, uint roundIndex, address sender);
event Transfer(address indexed to, uint256 amount);

function test_AdvanceRound() public {
Expand Down Expand Up @@ -63,7 +63,7 @@ contract ImpactEvaluatorTest is Test {
ImpactEvaluator impactEvaluator = new ImpactEvaluator(address(0x1));
assertEq(impactEvaluator.getRoundMeasurementsCids(0).length, 0);
vm.expectEmit(false, false, false, true);
emit MeasurementsAdded("cid", 0);
emit MeasurementsAdded("cid", 0, address(this));
uint roundIndex = impactEvaluator.addMeasurements("cid");
assertEq(roundIndex, 0);
assertEq(impactEvaluator.getRoundMeasurementsCids(0).length, 1);
Expand Down

0 comments on commit 88a5cca

Please sign in to comment.