Skip to content

Early termination #268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions contracts/ExclusiveGeyser.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ contract ExclusiveGeyser is Geyser {
uint256 amount,
bytes calldata permission
) public override {
// DISABLING STAKING
revert("Staking disabled");

// verify that vault isn't staking the same tokens in multiple programs
_enforceExclusiveStake(IUniversalVault(vault), amount);

Expand Down
18 changes: 10 additions & 8 deletions contracts/Geyser.sol
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,14 @@ contract Geyser is IGeyser, Powered, OwnableUpgradeable {
emit GeyserFunded(amount, duration);
}

/// @notice Allows owner to terminate an existing reward schedule.
/// @param index The index of the reward schedule to terminate.
function terminateRewardSchedule(uint256 index) external onlyOwner {
RewardSchedule storage reward = _geyser.rewardSchedules[index];
require(reward.start + reward.duration > block.timestamp, "Reward schedule ended");
reward.duration = (block.timestamp - reward.start);
}

/// @notice Add vault factory to whitelist
/// @dev use this function to enable stakes to vaults coming from the specified
/// factory contract
Expand Down Expand Up @@ -737,8 +745,8 @@ contract Geyser is IGeyser, Powered, OwnableUpgradeable {
}

/// @notice Rescue tokens from RewardPool
/// @dev use this function to rescue tokens from RewardPool contract
/// without distributing to stakers or triggering emergency shutdown
/// @dev Use this function to rescue tokens from RewardPool contract
/// without distributing to stakers or triggering emergency shutdown.
/// access control: only admin
/// state machine:
/// - can be called multiple times
Expand All @@ -756,12 +764,6 @@ contract Geyser is IGeyser, Powered, OwnableUpgradeable {
// verify recipient
_validateAddress(recipient);

// check not attempting to unstake reward token
require(token != _geyser.rewardToken, "Geyser: invalid address");

// check not attempting to wthdraw bonus token
require(!_bonusTokenSet.contains(token), "Geyser: invalid address");

// transfer tokens to recipient
IRewardPool(_geyser.rewardPool).sendERC20(token, recipient, amount);
}
Expand Down
11 changes: 10 additions & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,15 @@ task('create-vault', 'deploy an instance of UniversalVault')
await createInstance('UniversalVault', vaultFactory, ethers.getContractAt, signer)
})

task('deploy-geyser-template', 'deploys the current geyser template')
.addOptionalParam('instanceType', 'the type of geyser to be deployed', 'Geyser')
.setAction(async ({ instanceType }, { ethers, run, network, upgrades }) => {
await run('compile')
const signer = (await ethers.getSigners())[0]
console.log('Signer', signer.address)
await deployContract(instanceType, ethers.getContractFactory, signer)
})

task('create-geyser', 'deploy an instance of Geyser')
.addParam('stakingToken', 'the staking token')
.addParam('rewardToken', 'the reward token')
Expand Down Expand Up @@ -357,7 +366,7 @@ export default {
allowUnlimitedContractSize: true,
},
mainnet: {
url: `https://mainnet.infura.io/v3/${process.env.INFURA_SECRET}`,
url: `https://eth-mainnet.g.alchemy.com/v2/${process.env.ALCHEMY_SECRET}`,
accounts: {
mnemonic: process.env.PROD_MNEMONIC || Wallet.createRandom().mnemonic.phrase,
},
Expand Down
Loading