-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from threshold-network/system-tests
System tests for KEEP<>T staking contracts interactions System tests are performed on mainnet block 13619810 fork chain using three real stakers from KEEP network: liquid token staker, managed grant staker, and non-managed grant staker. Stake delegation - Given I am KEEP network liquid token staker, when I have authorized T staking contract, when I have not undelegated my legacy stake, `stakeKeep` should copy my stake to T staking contract. - Given I am KEEP network liquid token staker, when I have authorized T staking contract, when I have undelegated my legacy stake, `stakeKeep` should revert. Top-ups - Given I am KEEP network liquid token staker, when I copied my stake to T staking contract, when I executed top-up of my legacy stake, `topUpKeep` should top-up my stake in T staking contract. Stake undelegation - Given I am KEEP network liquid token staker, when I copied my stake to T staking contract, when I authorized and deauthorized application, `unstakeKeep` should release my KEEP stake. - Given I am KEEP network liquid token staker, when I copied my stake to T staking contract, when I authorized and deauthorized application, `unstakeKeep` should let me undelegate my KEEP stake. Slashing - Given I am KEEP network liquid token staker, when I copied my stake to T staking contract, when I authorized application, when I got slashed by the application, `processSlashing` should slash my KEEP stake. - Given I am KEEP network liquid token staker, when I copied my stake to T staking contract, when I authorized application, when I got slashed by the application, `notifyKeepStakeDiscrepancy` should revert. - Given I am KEEP network liquid token staker, when I copied my stake to T staking contract, when I authorized application, when the application seized my stake, `processSlashing` should seize my KEEP stake. - Given I am KEEP network liquid token staker, when I copied my stake to T staking contract, when I authorized application, when the application seized my stake, `notifyKeepStakeDiscrepancy` should revert. Exactly the same tests are repeated for two other types of actors: - Given I am KEEP network managed grant staker... - Given I am KEEP network non-managed grant staker...
- Loading branch information
Showing
7 changed files
with
533 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
pragma solidity 0.8.9; | ||
|
||
import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | ||
|
||
interface IKeepToken is IERC20 { | ||
function approveAndCall( | ||
address spender, | ||
uint256 value, | ||
bytes memory extraData | ||
) external returns (bool success); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
pragma solidity 0.8.9; | ||
|
||
import "../staking/ILegacyTokenStaking.sol"; | ||
|
||
interface IKeepTokenGrant { | ||
function stake( | ||
uint256 id, | ||
address stakingContract, | ||
uint256 amount, | ||
bytes memory extraData | ||
) external; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.