Skip to content

Commit

Permalink
fix: make mode only investment chain by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Divya-Solulab committed Nov 20, 2024
1 parent 073912e commit e392022
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
1 change: 0 additions & 1 deletion operate/services/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ def ledger_configs(self) -> "LedgerConfigs":
chain=chain,
type=LedgerType.ETHEREUM,
)
print(f"Adding {chain} {config['address']}")
return ledger_configs

def deployment_config(self) -> DeploymentConfig:
Expand Down
25 changes: 14 additions & 11 deletions run_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ def configure_local_config() -> OptimusConfig:
optimus_config.staking_chain = ""

if optimus_config.principal_chain is None:
optimus_config.principal_chain = optimus_config.staking_chain if optimus_config.staking_chain else DEFAULT_STAKING_CHAIN
optimus_config.principal_chain = optimus_config.staking_chain if optimus_config.staking_chain else DEFAULT_STAKING_CHAIN.lower()

if optimus_config.investment_funding_requirements is None:
optimus_config.investment_funding_requirements = {
Expand All @@ -385,29 +385,32 @@ def configure_local_config() -> OptimusConfig:

print_section("Investment Activity Chains & RPCs")
print("All available chains for liquidity pool opportunities:", ", ".join(DEFAULT_CHAINS))
print("Current setting for liquidity pool opportunities--Chains:", ", ".join(optimus_config.target_investment_chains or DEFAULT_CHAINS))
print("Current setting for liquidity pool opportunities--Chains:", ", ".join(optimus_config.target_investment_chains or [DEFAULT_STAKING_CHAIN]))

update_chains = input("Do you want to expand/restrict the agent’s operability in terms of investment chains (y/n): ").lower() == 'y'
if update_chains:
allowed_chains = DEFAULT_CHAINS.copy()
target_investment_chains = DEFAULT_CHAINS.copy()
allowed_chains = []
target_investment_chains = []
for chain in DEFAULT_CHAINS:
operate_on_chain = input(f"Do you wish the service to operate by investing on the {chain} chain? (y/n): ").lower() == 'y'
if not operate_on_chain:
if chain in target_investment_chains:
target_investment_chains.remove(chain)
if operate_on_chain:
if chain not in target_investment_chains:
target_investment_chains.append(chain)

if chain.lower() != optimus_config.principal_chain and chain in allowed_chains:
allowed_chains.remove(chain)
if chain not in allowed_chains:
allowed_chains.append(chain)

if optimus_config.principal_chain not in allowed_chains:
allowed_chains.append(optimus_config.principal_chain)

optimus_config.allowed_chains = [chain.lower() for chain in allowed_chains]
optimus_config.target_investment_chains = [chain.lower() for chain in target_investment_chains]

if optimus_config.allowed_chains is None:
optimus_config.allowed_chains = DEFAULT_CHAINS.copy()
optimus_config.allowed_chains = [optimus_config.principal_chain]

if optimus_config.target_investment_chains is None:
optimus_config.target_investment_chains = DEFAULT_CHAINS.copy()
optimus_config.target_investment_chains = [optimus_config.principal_chain]

for chain in optimus_config.allowed_chains:
if chain == "optimism" and optimus_config.optimism_rpc is None:
Expand Down
2 changes: 1 addition & 1 deletion staking_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def staking_report(config: dict) -> None:
multisig_nonces_since_last_cp = multisig_nonces - multisig_nonces_on_last_checkpoint
multisig_nonces_current_epoch = multisig_nonces_since_last_cp
_print_status(
"Num. txs current epoch",
f"{str(home_chain_type).rsplit('.', maxsplit=1)[-1]} txs in current epoch ",
str(multisig_nonces_current_epoch),
_warning_message(
Decimal(multisig_nonces_current_epoch),
Expand Down

0 comments on commit e392022

Please sign in to comment.