mirror of https://github.com/logos-co/staking.git
fix(StakeManager): check for valid migration address
This commit is contained in:
parent
52a69324a6
commit
a2831a8da5
|
@ -16,6 +16,7 @@ contract StakeManager is Ownable {
|
||||||
error StakeManager__InvalidLimitEpoch();
|
error StakeManager__InvalidLimitEpoch();
|
||||||
error StakeManager__InvalidLockupPeriod();
|
error StakeManager__InvalidLockupPeriod();
|
||||||
error StakeManager__AccountNotInitialized();
|
error StakeManager__AccountNotInitialized();
|
||||||
|
error StakeManager__InvalidMigration();
|
||||||
|
|
||||||
struct Account {
|
struct Account {
|
||||||
address rewardAddress;
|
address rewardAddress;
|
||||||
|
@ -223,6 +224,9 @@ contract StakeManager is Ownable {
|
||||||
* @param _migration new StakeManager
|
* @param _migration new StakeManager
|
||||||
*/
|
*/
|
||||||
function startMigration(StakeManager _migration) external onlyOwner noMigration processEpoch {
|
function startMigration(StakeManager _migration) external onlyOwner noMigration processEpoch {
|
||||||
|
if (_migration == this || address(_migration) == address(0)) {
|
||||||
|
revert StakeManager__InvalidMigration();
|
||||||
|
}
|
||||||
migration = _migration;
|
migration = _migration;
|
||||||
stakedToken.transfer(address(migration), epochReward());
|
stakedToken.transfer(address(migration), epochReward());
|
||||||
migration.migrationInitialize(currentEpoch, totalSupplyMP, totalSupplyBalance, epochs[currentEpoch].startTime);
|
migration.migrationInitialize(currentEpoch, totalSupplyMP, totalSupplyBalance, epochs[currentEpoch].startTime);
|
||||||
|
|
Loading…
Reference in New Issue