-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* updated deps * exclusive stake geyser * fixed incorrect check
- Loading branch information
1 parent
1afad52
commit 28443cc
Showing
5 changed files
with
2,465 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
pragma solidity 0.7.6; | ||
pragma abicoder v2; | ||
|
||
import {IUniversalVault} from "./UniversalVault.sol"; | ||
import {Geyser} from "./Geyser.sol"; | ||
|
||
/// @title ExclusiveGeyser | ||
/// @notice A special extension of GeyserV2 which allows staking in, | ||
/// at most one distribution program in any given time, for a given staking token. | ||
/// @dev Security contact: [email protected] | ||
contract ExclusiveGeyser is Geyser { | ||
/// @inheritdoc Geyser | ||
function stake( | ||
address vault, | ||
uint256 amount, | ||
bytes calldata permission | ||
) public override { | ||
// verify that vault has NOT locked staking token in other programs | ||
_enforceExclusiveStake(IUniversalVault(vault)); | ||
|
||
// continue with regular stake | ||
super.stake(vault, amount, permission); | ||
} | ||
|
||
function _enforceExclusiveStake(IUniversalVault vault) private view { | ||
address stakingToken = super.getGeyserData().stakingToken; | ||
uint256 lockCount = vault.getLockSetCount(); | ||
for (uint256 i = 0; i < lockCount; i++) { | ||
IUniversalVault.LockData memory lock = vault.getLockAt(i); | ||
if(lock.token == stakingToken){ | ||
require(lock.delegate == address(this), "ExclusiveGeyser: expected exclusive stake"); | ||
} | ||
} | ||
} | ||
} |
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
Binary file not shown.
Oops, something went wrong.