Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #305 from maticnetwork/shares-tests
Browse files Browse the repository at this point in the history
Shares tests
  • Loading branch information
jdkanani authored Jun 29, 2020
2 parents 95f6164 + 14d124d commit 9749201
Show file tree
Hide file tree
Showing 2 changed files with 261 additions and 97 deletions.
6 changes: 5 additions & 1 deletion contracts/staking/stakeManager/StakeManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ contract StakeManager is IStakeManager, StakeManagerStorage, Initializable {
uint256 amount,
address delegator
) external returns (bool) {
require(delegationEnabled, "Delegation is disabled");
require(validators[validatorId].contractAddress == msg.sender, "Invalid contract address");
return token.transferFrom(delegator, address(this), amount);
}
Expand Down Expand Up @@ -427,6 +426,11 @@ contract StakeManager is IStakeManager, StakeManagerStorage, Initializable {
}

function updateValidatorState(uint256 validatorId, int256 amount) public {
if (amount > 0) {
// deposit during shares purchase
require(delegationEnabled, "Delegation is disabled");
}

require(validators[validatorId].contractAddress == msg.sender, "Invalid contract address");
updateTimeline(amount, 0, 0);
}
Expand Down
Loading

0 comments on commit 9749201

Please sign in to comment.