Skip to content

Commit

Permalink
chore: index epoch in events (#968)
Browse files Browse the repository at this point in the history
  • Loading branch information
SamAg19 committed Sep 19, 2022
1 parent 07f8cb1 commit 8dee2b9
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 26 deletions.
23 changes: 14 additions & 9 deletions contracts/Core/BlockManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ contract BlockManager is Initializable, BlockStorage, StateManager, BlockManager
* @param medians of the confirmed block
* @param timestamp time when the block was confirmed
*/
event BlockConfirmed(uint32 epoch, uint32 indexed stakerId, uint16[] ids, uint256 timestamp, uint256[] medians);
event BlockConfirmed(uint32 indexed epoch, uint32 indexed stakerId, uint16[] ids, uint256 timestamp, uint256[] medians);

/**
* @dev Emitted when a staker claims block reward
* @param epoch epoch when the block reward was claimed
* @param stakerId id of the staker that claimed the block reward
* @param timestamp time when the block reward was claimed
*/
event ClaimBlockReward(uint32 epoch, uint32 indexed stakerId, uint256 timestamp);
event ClaimBlockReward(uint32 indexed epoch, uint32 indexed stakerId, uint256 timestamp);

/**
* @dev Emitted when a block is proposed
Expand All @@ -53,7 +53,7 @@ contract BlockManager is Initializable, BlockStorage, StateManager, BlockManager
* @param timestamp time when the block was proposed
*/
event Proposed(
uint32 epoch,
uint32 indexed epoch,
uint32 indexed stakerId,
uint32 biggestStakerId,
uint16[] ids,
Expand All @@ -68,7 +68,7 @@ contract BlockManager is Initializable, BlockStorage, StateManager, BlockManager
* @param leafId index of the collection that is to be disputed
* @param sortedValues values reported by staker for a collection in ascending order
*/
event GiveSorted(uint32 epoch, uint16 indexed leafId, uint256[] sortedValues);
event GiveSorted(uint32 indexed epoch, uint16 indexed leafId, uint256[] sortedValues);

/**
* @dev Emitted when the disputer raise dispute for biggestStakeProposed
Expand All @@ -77,7 +77,12 @@ contract BlockManager is Initializable, BlockStorage, StateManager, BlockManager
* @param correctBiggestStakerId the correct biggest staker id
* @param disputer address that raised the dispute
*/
event DisputeBiggestStakeProposed(uint32 epoch, uint8 blockIndex, uint32 indexed correctBiggestStakerId, address indexed disputer);
event DisputeBiggestStakeProposed(
uint32 indexed epoch,
uint8 blockIndex,
uint32 indexed correctBiggestStakerId,
address indexed disputer
);

/**
* @dev Emitted when the disputer raise dispute for collection id that should be absent
Expand All @@ -88,7 +93,7 @@ contract BlockManager is Initializable, BlockStorage, StateManager, BlockManager
* @param disputer address that raised the dispute
*/
event DisputeCollectionIdShouldBeAbsent(
uint32 epoch,
uint32 indexed epoch,
uint8 blockIndex,
uint32 indexed id,
uint256 postionOfCollectionInBlock,
Expand All @@ -102,7 +107,7 @@ contract BlockManager is Initializable, BlockStorage, StateManager, BlockManager
* @param id collection id that should be present
* @param disputer address that raised the dispute
*/
event DisputeCollectionIdShouldBePresent(uint32 epoch, uint8 blockIndex, uint32 indexed id, address indexed disputer);
event DisputeCollectionIdShouldBePresent(uint32 indexed epoch, uint8 blockIndex, uint32 indexed id, address indexed disputer);

/**
* @dev Emitted when the disputer raise dispute for the ids passed are not sorted in ascend order, or there is duplication
Expand All @@ -112,7 +117,7 @@ contract BlockManager is Initializable, BlockStorage, StateManager, BlockManager
* @param index1 upper
* @param disputer address that raised the dispute
*/
event DisputeOnOrderOfIds(uint32 epoch, uint8 blockIndex, uint256 index0, uint256 index1, address indexed disputer);
event DisputeOnOrderOfIds(uint32 indexed epoch, uint8 blockIndex, uint256 index0, uint256 index1, address indexed disputer);

/**
* @dev Emitted when the disputer calls finalizeDispute
Expand All @@ -121,7 +126,7 @@ contract BlockManager is Initializable, BlockStorage, StateManager, BlockManager
* @param postionOfCollectionInBlock position of collection id to be disputed inside ids proposed by block
* @param disputer address that raised the dispute
*/
event FinalizeDispute(uint32 epoch, uint8 blockIndex, uint256 postionOfCollectionInBlock, address indexed disputer);
event FinalizeDispute(uint32 indexed epoch, uint8 blockIndex, uint256 postionOfCollectionInBlock, address indexed disputer);

/**
* @param stakeManagerAddress The address of the StakeManager contract
Expand Down
6 changes: 3 additions & 3 deletions contracts/Core/CollectionManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ contract CollectionManager is Initializable, CollectionStorage, StateManager, Co
event JobUpdated(
uint16 indexed id,
JobSelectorType selectorType,
uint32 epoch,
uint32 indexed epoch,
uint8 weight,
int8 power,
uint256 timestamp,
Expand All @@ -57,7 +57,7 @@ contract CollectionManager is Initializable, CollectionStorage, StateManager, Co
* @param epoch in which the status change took place
* @param timestamp time at which the status change took place
*/
event CollectionActivityStatus(bool active, uint16 indexed id, uint32 epoch, uint256 timestamp);
event CollectionActivityStatus(bool active, uint16 indexed id, uint32 indexed epoch, uint256 timestamp);

/**
* @dev Emitted when a collection has been updated
Expand All @@ -72,7 +72,7 @@ contract CollectionManager is Initializable, CollectionStorage, StateManager, Co
event CollectionUpdated(
uint16 indexed id,
int8 power,
uint32 epoch,
uint32 indexed epoch,
uint32 aggregationMethod,
uint32 tolerance,
uint16[] updatedJobIDs,
Expand Down
34 changes: 24 additions & 10 deletions contracts/Core/StakeManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ contract StakeManager is Initializable, StakeStorage, StateManager, Pause, Stake
* @param timestamp time at which the change took place
*/
event StakeChange(
uint32 epoch,
uint32 indexed epoch,
uint32 indexed stakerId,
Constants.StakeChanged reason,
uint256 prevStake,
Expand All @@ -62,7 +62,7 @@ contract StakeManager is Initializable, StakeStorage, StateManager, Pause, Stake
* @param timestamp time at which the change took place
*/
event StakerRewardChange(
uint32 epoch,
uint32 indexed epoch,
uint32 indexed stakerId,
Constants.StakerRewardChanged reason,
uint256 prevStakerReward,
Expand All @@ -78,7 +78,7 @@ contract StakeManager is Initializable, StakeStorage, StateManager, Pause, Stake
* @param reason reason why the the change in age took place
* @param timestamp time at which the change took place
*/
event AgeChange(uint32 epoch, uint32 indexed stakerId, uint32 newAge, Constants.AgeChanged reason, uint256 timestamp);
event AgeChange(uint32 indexed epoch, uint32 indexed stakerId, uint32 newAge, Constants.AgeChanged reason, uint256 timestamp);

/**
* @dev Emitted when staker stakes for the first time or adds stake.
Expand All @@ -94,7 +94,7 @@ contract StakeManager is Initializable, StakeStorage, StateManager, Pause, Stake
event Staked(
address indexed staker,
address sToken,
uint32 epoch,
uint32 indexed epoch,
uint32 indexed stakerId,
uint256 amount,
uint256 newStake,
Expand All @@ -111,7 +111,14 @@ contract StakeManager is Initializable, StakeStorage, StateManager, Pause, Stake
* @param newStake current stake after unstaking
* @param timestamp time at which the staker/delegator unstaked
*/
event Unstaked(address indexed staker, uint32 epoch, uint32 indexed stakerId, uint256 amount, uint256 newStake, uint256 timestamp);
event Unstaked(
address indexed staker,
uint32 indexed epoch,
uint32 indexed stakerId,
uint256 amount,
uint256 newStake,
uint256 timestamp
);

/**
* @dev Emitted when staker/delegator initiates withdraw.
Expand All @@ -125,7 +132,7 @@ contract StakeManager is Initializable, StakeStorage, StateManager, Pause, Stake
*/
event WithdrawInitiated(
address indexed staker,
uint32 epoch,
uint32 indexed epoch,
uint32 indexed stakerId,
uint256 amount,
uint256 newStake,
Expand All @@ -142,7 +149,14 @@ contract StakeManager is Initializable, StakeStorage, StateManager, Pause, Stake
* @param newStake current stake after withdraw process is completed
* @param timestamp time at which the staker/delegator withdrew
*/
event Withdrew(address indexed staker, uint32 epoch, uint32 indexed stakerId, uint256 amount, uint256 newStake, uint256 timestamp);
event Withdrew(
address indexed staker,
uint32 indexed epoch,
uint32 indexed stakerId,
uint256 amount,
uint256 newStake,
uint256 timestamp
);

/**
* @dev Emitted when delegator delegates his RAZOR to a particular staker.
Expand All @@ -156,7 +170,7 @@ contract StakeManager is Initializable, StakeStorage, StateManager, Pause, Stake
*/
event Delegated(
address indexed delegator,
uint32 epoch,
uint32 indexed epoch,
uint32 indexed stakerId,
uint256 amount,
uint256 newStake,
Expand All @@ -178,15 +192,15 @@ contract StakeManager is Initializable, StakeStorage, StateManager, Pause, Stake
* @param staker address of the staker/delegator
* @param epoch in which the reset took place
*/
event ResetLock(uint32 indexed stakerId, address indexed staker, uint32 epoch);
event ResetLock(uint32 indexed stakerId, address indexed staker, uint32 indexed epoch);

/**
* @dev Emitted when the staker/delegator extends unstake lock
* @param stakerId the stakerId for which extension took place
* @param staker address of the staker/delegator
* @param epoch in which the extension took place
*/
event ResetUnstakeLock(uint32 indexed stakerId, address indexed staker, uint32 epoch);
event ResetUnstakeLock(uint32 indexed stakerId, address indexed staker, uint32 indexed epoch);

/**
* @dev Emitted when the staker changes commission
Expand Down
6 changes: 3 additions & 3 deletions contracts/Core/VoteManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ contract VoteManager is Initializable, VoteStorage, StateManager, VoteManagerPar
* @param commitment the staker's commitment
* @param timestamp time when the commitment was set for the staker
*/
event Committed(uint32 epoch, uint32 indexed stakerId, bytes32 commitment, uint256 timestamp);
event Committed(uint32 indexed epoch, uint32 indexed stakerId, bytes32 commitment, uint256 timestamp);
/**
* @dev Emitted when a staker reveals
* @param epoch epoch when the staker revealed
Expand All @@ -39,14 +39,14 @@ contract VoteManager is Initializable, VoteStorage, StateManager, VoteManagerPar
* @param values of the collections assigned to the staker
* @param timestamp time when the staker revealed
*/
event Revealed(uint32 epoch, uint32 indexed stakerId, uint256 influence, Structs.AssignedAsset[] values, uint256 timestamp);
event Revealed(uint32 indexed epoch, uint32 indexed stakerId, uint256 influence, Structs.AssignedAsset[] values, uint256 timestamp);
/**
* @dev Emitted when bountyHunter snitch the staker
* @param epoch epoch when the bountyHunter snitch the staker
* @param stakerId id of the staker that is snitched
* @param bountyHunter address who will snitch the staker
*/
event Snitch(uint32 epoch, uint32 indexed stakerId, address indexed bountyHunter);
event Snitch(uint32 indexed epoch, uint32 indexed stakerId, address indexed bountyHunter);

/**
* @param stakeManagerAddress The address of the StakeManager contract
Expand Down
2 changes: 1 addition & 1 deletion contracts/randomNumber/RandomNoManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import "./RandomNoStorage.sol";
*/

contract RandomNoManager is Initializable, StateManager, RandomNoStorage, RandomNoManagerParams, IRandomNoClient, IRandomNoProvider {
event RandomNumberAvailable(uint32 epoch);
event RandomNumberAvailable(uint32 indexed epoch);

/**
* @param blockManagerAddress The address of the BlockManager Contract
Expand Down

0 comments on commit 8dee2b9

Please sign in to comment.