Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event issues #53

Closed
ducthotran2010 opened this issue Nov 4, 2022 · 4 comments · Fixed by #77
Closed

Event issues #53

ducthotran2010 opened this issue Nov 4, 2022 · 4 comments · Fixed by #77

Comments

@ducthotran2010
Copy link
Collaborator

ducthotran2010 commented Nov 4, 2022

    Comments for interfaces and documents

Originally posted by @nxqbao in #22 (review)

Missing event indexed for importance params

@ducthotran2010
Copy link
Collaborator Author

    Declaration of structs should be placed at the top inside the contract. 

Convention note:

Inside each contract, library or interface, use the following order:

  1. Type declarations
  2. State variables
  3. Events
  4. Modifiers
  5. Functions

Originally posted by @nxqbao in #22 (comment)

/// @dev Emitted when the settled pool is updated.
event SettledPoolsUpdated(address[] poolAddress, uint256[] accumulatedRps);
/// @dev Emitted when the pending pool is updated.
event PendingPoolUpdated(address poolAddress, uint256 accumulatedRps);
/// @dev Emitted when the fields to calculate settled reward for the user is updated.
event SettledRewardUpdated(address poolAddress, address user, uint256 debited, uint256 accumulatedRps);
/// @dev Emitted when the fields to calculate pending reward for the user is updated.
event PendingRewardUpdated(address poolAddress, address user, uint256 debited, uint256 credited);
/// @dev Emitted when the user claimed their reward
event RewardClaimed(address poolAddress, address user, uint256 amount);
struct PendingRewardFields {
// Recorded reward amount.
uint256 debited;
// The amount rewards that user have already earned.
uint256 credited;
// Last period number that the info updated.
uint256 lastSyncedPeriod;
}
struct SettledRewardFields {
// Recorded reward amount.
uint256 debited;
// Accumulated of the amount rewards per share (one unit staking).
uint256 accumulatedRps;
}
struct PendingPool {
// Accumulated of the amount rewards per share (one unit staking).
uint256 accumulatedRps;
}
struct SettledPool {
// Last period number that the info updated.
uint256 lastSyncedPeriod;
// Accumulated of the amount rewards per share (one unit staking).
uint256 accumulatedRps;
}

@ducthotran2010
Copy link
Collaborator Author

    Consider add `indexed` for `address` fields in these events.

Originally posted by @nxqbao in #22 (comment)

@ducthotran2010
Copy link
Collaborator Author

    Event declarations must be placed after enum and struct.

Originally posted by @nxqbao in #22 (comment)

@nxqbao
Copy link
Contributor

nxqbao commented Nov 11, 2022

All indexed events have been fixed in various feat/fix PRs.

nxqbao added a commit that referenced this issue Nov 13, 2022
* Fix [ValidatorSet] Refactor period length of `1 days` to a constant #61

* Place structs on top of the interfaces (Fix #53)

* Fix #60

* Fix #52

* Remove redundant castings (Fix #49)

* Update docs

* Change `memory` to `calldata` in external query array (partially fix #50)

* Optimizing equation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants