Skip to content

Commit

Permalink
fix H-1
Browse files Browse the repository at this point in the history
  • Loading branch information
FedokDL committed Dec 30, 2024
1 parent b18601f commit f708007
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
7 changes: 6 additions & 1 deletion smart-contracts/contracts/delegate/ProvidersDelegate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ contract ProvidersDelegate is IProvidersDelegate, OwnableUpgradeable {
}

function _stake(address staker_, uint256 amount_) private {
if (isStakeClosed && !isDeregisterAvailable()) {
if (isStakeClosed && !isStakeAfterDeregisterAvailable()) {
revert StakeClosed();
}
if (amount_ == 0) {
Expand Down Expand Up @@ -250,6 +250,11 @@ contract ProvidersDelegate is IProvidersDelegate, OwnableUpgradeable {
return block.timestamp >= deregistrationOpensAt;
}

function isStakeAfterDeregisterAvailable() public view returns (bool) {
IProviderRegistry.Provider memory provider_ = IProviderRegistry(lumerinDiamond).getProvider(address(this));
return isDeregisterAvailable() && provider_.stake > 0 && provider_.isDeleted;
}

function _deleteModelBids(bytes32[] calldata bidIds_) private {
address lumerinDiamond_ = lumerinDiamond;

Expand Down
5 changes: 0 additions & 5 deletions smart-contracts/test/delegate/ProvidersDelegate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,6 @@ describe('ProvidersDelegate', () => {
expect(await token.balanceOf(KYLE)).to.eq(wei(900));
expect(await token.balanceOf(SHEV)).to.eq(wei(800));
});
it('should stake tokens when stake closed but deregistration is available', async () => {
await providersDelegate.setIsStakeClosed(true);
await setTime(payoutStart + 4 * DAY);
await providersDelegate.connect(KYLE).stake(wei(100));
});
it('should throw error when the stake is too low', async () => {
await expect(providersDelegate.connect(KYLE).stake(wei(0))).to.be.revertedWithCustomError(
providersDelegate,
Expand Down

0 comments on commit f708007

Please sign in to comment.