Skip to content

Commit

Permalink
Merge pull request #19 from pnetwork-association/refactor/sentinerl-r…
Browse files Browse the repository at this point in the history
…eg-updated-event
  • Loading branch information
oliviera9 authored Oct 31, 2023
2 parents a22a58d + 2e847c5 commit b30ac82
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
9 changes: 8 additions & 1 deletion contracts/core/RegistrationManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,14 @@ contract RegistrationManager is IRegistrationManager, Initializable, UUPSUpgrade
}
registration.endEpoch = endEpoch;

emit DurationIncreased(sentinel, endEpoch);
emit SentinelRegistrationUpdated(
owner,
registration.startEpoch,
registration.endEpoch,
sentinel,
Constants.REGISTRATION_SENTINEL_STAKING,
stake.amount
);
}

function _getActorAddressFromSignatureAndIncreaseSignatureNonce(
Expand Down
8 changes: 0 additions & 8 deletions contracts/interfaces/IRegistrationManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ interface IRegistrationManager {
*/
event BorrowingSentinelSlashed(address indexed sentinel);

/**
* @dev Emitted when an user increases his staking sentinel registration position by increasing his lock time within the Staking Manager.
*
* @param sentinel The sentinel
* @param endEpoch The new end epoch
*/
event DurationIncreased(address indexed sentinel, uint16 endEpoch);

/**
* @dev Emitted when a guardian is slashed.
*
Expand Down
12 changes: 6 additions & 6 deletions test/RegistrationManager.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -616,8 +616,8 @@ describe('RegistrationManager', () => {
expect(await epochsManager.currentEpoch()).to.be.equal(3)
duration = EPOCH_DURATION * 4
await expect(registrationManager.connect(pntHolder1)['increaseSentinelRegistrationDuration(uint64)'](duration))
.to.emit(registrationManager, 'DurationIncreased')
.withArgs(sentinel1.address, 10)
.to.emit(registrationManager, 'SentinelRegistrationUpdated')
.withArgs(pntHolder1.address, 3, 10, sentinel1.address, REGISTRATION_SENTINEL_STAKING, amount)

expect(await registrationManager.sentinelStakedAmountByEpochOf(sentinel1.address, 3)).to.be.eq(truncateWithPrecision(amount))
expect(await registrationManager.sentinelStakedAmountByEpochOf(sentinel1.address, 4)).to.be.eq(truncateWithPrecision(amount))
Expand Down Expand Up @@ -721,8 +721,8 @@ describe('RegistrationManager', () => {
expect(await epochsManager.currentEpoch()).to.be.equal(4)
duration = EPOCH_DURATION * 4
await expect(registrationManager.connect(pntHolder1)['increaseSentinelRegistrationDuration(uint64)'](duration))
.to.emit(registrationManager, 'DurationIncreased')
.withArgs(sentinel1.address, 9)
.to.emit(registrationManager, 'SentinelRegistrationUpdated')
.withArgs(pntHolder1.address, 3, 9, sentinel1.address, REGISTRATION_SENTINEL_STAKING, amount)

expect(await registrationManager.sentinelStakedAmountByEpochOf(sentinel1.address, 3)).to.be.eq(truncateWithPrecision(amount))
expect(await registrationManager.sentinelStakedAmountByEpochOf(sentinel1.address, 4)).to.be.eq(truncateWithPrecision(amount))
Expand Down Expand Up @@ -811,8 +811,8 @@ describe('RegistrationManager', () => {
await time.increase(EPOCH_DURATION * 5)
expect(await epochsManager.currentEpoch()).to.be.equal(7)
await expect(registrationManager.connect(pntHolder1)['increaseSentinelRegistrationDuration(uint64)'](duration))
.to.emit(registrationManager, 'DurationIncreased')
.withArgs(sentinel1.address, 10)
.to.emit(registrationManager, 'SentinelRegistrationUpdated')
.withArgs(pntHolder1.address, 8, 10, sentinel1.address, REGISTRATION_SENTINEL_STAKING, amount)

expect(await registrationManager.sentinelStakedAmountByEpochOf(sentinel1.address, 8)).to.be.eq(truncateWithPrecision(amount))
expect(await registrationManager.sentinelStakedAmountByEpochOf(sentinel1.address, 9)).to.be.eq(truncateWithPrecision(amount))
Expand Down

0 comments on commit b30ac82

Please sign in to comment.