Skip to content

Commit 2be870b

Browse files
committed
TokenStaking: removes refreshKeepStakeOwner
1 parent 5001013 commit 2be870b

File tree

4 files changed

+0
-178
lines changed

4 files changed

+0
-178
lines changed

contracts/staking/IStaking.sol

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,6 @@ interface IStaking {
7070
address authorizer
7171
) external;
7272

73-
/// @notice Refresh Keep stake owner. Can be called only by the old owner
74-
/// or their staking provider.
75-
/// @dev The staking provider in T staking contract is the legacy KEEP
76-
/// staking contract operator.
77-
function refreshKeepStakeOwner(address stakingProvider) external;
78-
7973
/// @notice Allows the Governance to set the minimum required stake amount.
8074
/// This amount is required to protect against griefing the staking
8175
/// contract and individual applications are allowed to require

contracts/staking/TokenStaking.sol

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -408,28 +408,6 @@ contract TokenStaking is Initializable, IStaking, Checkpoints {
408408
);
409409
}
410410

411-
/// @notice Refresh Keep stake owner. Can be called only by the old owner
412-
/// or their staking provider.
413-
/// @dev The staking provider in T staking contract is the legacy KEEP
414-
/// staking contract operator.
415-
function refreshKeepStakeOwner(address stakingProvider)
416-
external
417-
override
418-
onlyOwnerOrStakingProvider(stakingProvider)
419-
{
420-
StakingProviderInfo storage stakingProviderStruct = stakingProviders[
421-
stakingProvider
422-
];
423-
address newOwner = keepStake.resolveOwner(stakingProvider);
424-
425-
emit OwnerRefreshed(
426-
stakingProvider,
427-
stakingProviderStruct.owner,
428-
newOwner
429-
);
430-
stakingProviderStruct.owner = newOwner;
431-
}
432-
433411
/// @notice Allows the Governance to set the minimum required stake amount.
434412
/// This amount is required to protect against griefing the staking
435413
/// contract and individual applications are allowed to require

docs/rfc-1-staking-contract.adoc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,6 @@ additionally appointing beneficiary and authorizer roles. Caches the amount
307307
staked in NU staking contract. Can be called only by the original delegation
308308
owner.
309309

310-
==== `refreshKeepStakeOwner(address stakingProvider) external onlyOwnerOf(stakingProvider)`
311-
312-
Refresh Keep stake owner. Can be called only by the old owner.
313-
314310
==== `setMinimumStakeAmount(uint96 amount) external onlyGovernance`
315311

316312
Allows the governance to set the minimum required stake amount. This amount is

test/staking/TokenStaking.test.js

Lines changed: 0 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -852,152 +852,6 @@ describe("TokenStaking", () => {
852852
})
853853
})
854854

855-
describe("refreshKeepManagedGrantOwner", () => {
856-
context("when staking provider has no delegated stake", () => {
857-
it("should revert", async () => {
858-
await expect(
859-
tokenStaking
860-
.connect(stakingProvider)
861-
.refreshKeepStakeOwner(stakingProvider.address)
862-
).to.be.revertedWith("Not owner or provider")
863-
})
864-
})
865-
866-
context("when caller is neither old owner nor staking provider", () => {
867-
it("should revert", async () => {
868-
await tToken
869-
.connect(staker)
870-
.approve(tokenStaking.address, initialStakerBalance)
871-
await tokenStaking
872-
.connect(staker)
873-
.stake(
874-
stakingProvider.address,
875-
beneficiary.address,
876-
authorizer.address,
877-
initialStakerBalance
878-
)
879-
await expect(
880-
tokenStaking
881-
.connect(authorizer)
882-
.refreshKeepStakeOwner(stakingProvider.address)
883-
).to.be.revertedWith("Not owner or provider")
884-
})
885-
})
886-
887-
const contextRefreshKeepStakeOwner = (getCaller) => {
888-
context("when grantee was not changed", () => {
889-
let tx
890-
891-
beforeEach(async () => {
892-
const createdAt = 1
893-
await keepStakingMock.setOperator(
894-
stakingProvider.address,
895-
staker.address,
896-
beneficiary.address,
897-
authorizer.address,
898-
createdAt,
899-
0,
900-
initialStakerBalance
901-
)
902-
await keepStakingMock.setEligibility(
903-
stakingProvider.address,
904-
tokenStaking.address,
905-
true
906-
)
907-
await tokenStaking.stakeKeep(stakingProvider.address)
908-
909-
tx = await tokenStaking
910-
.connect(getCaller())
911-
.refreshKeepStakeOwner(stakingProvider.address)
912-
})
913-
914-
it("should not update owner", async () => {
915-
expect(
916-
await tokenStaking.rolesOf(stakingProvider.address)
917-
).to.deep.equal([
918-
staker.address,
919-
beneficiary.address,
920-
authorizer.address,
921-
])
922-
})
923-
924-
it("should emit OwnerRefreshed", async () => {
925-
await expect(tx)
926-
.to.emit(tokenStaking, "OwnerRefreshed")
927-
.withArgs(stakingProvider.address, staker.address, staker.address)
928-
})
929-
})
930-
931-
context("when grantee was changed", () => {
932-
let tx
933-
934-
beforeEach(async () => {
935-
const createdAt = 1
936-
await keepStakingMock.setOperator(
937-
stakingProvider.address,
938-
otherStaker.address,
939-
beneficiary.address,
940-
authorizer.address,
941-
createdAt,
942-
0,
943-
initialStakerBalance
944-
)
945-
await keepStakingMock.setEligibility(
946-
stakingProvider.address,
947-
tokenStaking.address,
948-
true
949-
)
950-
await tokenStaking.stakeKeep(stakingProvider.address)
951-
952-
await keepStakingMock.setOperator(
953-
stakingProvider.address,
954-
staker.address,
955-
beneficiary.address,
956-
authorizer.address,
957-
createdAt,
958-
0,
959-
initialStakerBalance
960-
)
961-
tx = await tokenStaking
962-
.connect(otherStaker)
963-
.refreshKeepStakeOwner(stakingProvider.address)
964-
})
965-
966-
it("should update owner", async () => {
967-
expect(
968-
await tokenStaking.rolesOf(stakingProvider.address)
969-
).to.deep.equal([
970-
staker.address,
971-
beneficiary.address,
972-
authorizer.address,
973-
])
974-
})
975-
976-
it("should emit OwnerRefreshed", async () => {
977-
await expect(tx)
978-
.to.emit(tokenStaking, "OwnerRefreshed")
979-
.withArgs(
980-
stakingProvider.address,
981-
otherStaker.address,
982-
staker.address
983-
)
984-
})
985-
})
986-
}
987-
988-
context("when caller is the old owner", () => {
989-
contextRefreshKeepStakeOwner(() => {
990-
return staker
991-
})
992-
})
993-
994-
context("when caller is the staking provider", () => {
995-
contextRefreshKeepStakeOwner(() => {
996-
return stakingProvider
997-
})
998-
})
999-
})
1000-
1001855
describe("approveApplication", () => {
1002856
context("when caller is not the governance", () => {
1003857
it("should revert", async () => {

0 commit comments

Comments
 (0)