@kyve/core-beta
Version:
🚀 The base KYVE node implementation.
47 lines (43 loc) • 1.5 kB
text/typescript
import { PoolStatus } from "@kyve/proto-beta/lcd/kyve/pool/v1beta1/pool";
import { Node } from "../..";
/**
* validateIsPoolActive checks if the pool is active or not.
* It returns true or false, wether it is active or not.
*
* @method validateIsPoolActive
* @param {Node} this
* @return {boolean}
*/
export function validateIsPoolActive(this: Node): boolean {
this.logger.debug(`Validating if pool is active: ${this.pool.status}`);
switch (this.pool.status as PoolStatus) {
case PoolStatus.POOL_STATUS_ACTIVE:
return false;
case PoolStatus.POOL_STATUS_PAUSED:
this.logger.info(
"Pool is paused. Waiting for pool being unpaused. Idling ..."
);
return true;
case PoolStatus.POOL_STATUS_NO_FUNDS:
this.logger.info(
"Pool is out of funds. Waiting for additional funds. Idling ..."
);
return true;
case PoolStatus.POOL_STATUS_NOT_ENOUGH_DELEGATION:
this.logger.info(
"Not enough delegation in pool. Waiting for additional delegation. Idling ..."
);
return true;
case PoolStatus.POOL_STATUS_UPGRADING:
this.logger.info(
"Pool is currently upgrading. Waiting for upgrade being applied. Idling ..."
);
return true;
case PoolStatus.POOL_STATUS_UNSPECIFIED:
this.logger.info("Pool status is currently unspecified. Idling ...");
return true;
default:
this.logger.info("Pool status is currently unknown. Idling ...");
return true;
}
}