Skip to content
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

Chore: Add new staking programs for trader #26

Merged
merged 4 commits into from
Feb 4, 2025
Merged
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
11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ Ensure your machine satisfies the requirements:

## Run the Service

### For Non-Stakers

Clone this repository locally and execute:

```bash
Expand All @@ -46,6 +44,8 @@ where `agent_config.json` is the path to your agent configuration file. Check th
| Modius | `configs/config_modius.json` | [Modius README](https://github.com/valory-xyz/modius-quickstart) |
| Memeooorr | `configs/config_memeooorr.json` | [Memeooorr README](https://github.com/dvilelaf/meme-ooorr) |

### For Non-Stakers

Answer `1) No staking` when prompted:

```text
Expand All @@ -61,13 +61,6 @@ Please, select your staking program preference

Each staking program has different OLAS requirements. The script will check that your owner address meets the minimum required OLAS on the required Chain.

Clone this repository locally and execute:

```bash
chmod +x run_service.sh
./run_service.sh
```

Select your preferred staking program when prompted (example):

```text
Expand Down
14 changes: 11 additions & 3 deletions configs/config_predict_trader.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Trader Agent",
"agent_id": 14,
"hash": "bafybeidr735y3y7sto7t7bdzxf4xwvnk4h4xgzr5gkssa34hu6mu2bukoq",
"agent_id": 25,
"hash": "bafybeib56fc36pednrzbfqxijvini4j6n4rqdfys43axctgbg4jql7tqmy",
"description": "Trader agent for omen prediction markets",
"image": "https://operate.olas.network/_next/image?url=%2Fimages%2Fprediction-agent.png&w=3840&q=75",
"service_version": "v0.23.0",
Expand Down Expand Up @@ -34,7 +34,9 @@
"quickstart_beta_expert_9": "0x17dBAe44BC5618Cc254055b386A29576b4F87015",
"quickstart_beta_expert_10": "0xB0ef657b8302bd2c74B6E6D9B2b4b39145b19c6f",
"quickstart_beta_expert_11": "0x3112c1613eAC3dBAE3D4E38CeF023eb9E2C91CF7",
"quickstart_beta_expert_12": "0xF4a75F476801B3fBB2e7093aCDcc3576593Cc1fc"
"quickstart_beta_expert_12": "0xF4a75F476801B3fBB2e7093aCDcc3576593Cc1fc",
"quickstart_beta_expert_15_mech_marketplace": "0x88eB38FF79fBa8C19943C0e5Acfa67D5876AdCC1",
"quickstart_beta_expert_16_mech_marketplace": "0x6c65430515c70a3f5E62107CC301685B7D46f991"
},
"env_variables": {
"GNOSIS_LEDGER_RPC": {
Expand Down Expand Up @@ -73,6 +75,12 @@
"value": "",
"provision_type": "computed"
},
"USE_MECH_MARKETPLACE": {
"name": "Use mech marketplace",
"description": "",
"value": "",
"provision_type": "computed"
},
"TRADING_STRATEGY": {
"name": "Trading strategy",
"description": "",
Expand Down
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ include = []

[tool.poetry.dependencies]
python = ">=3.9,<3.12"
olas-operate-middleware = { git = "https://github.com/valory-xyz/olas-operate-app.git", rev = "c5e385009081f924de9241454b7777b82f7e798a"}
olas-operate-middleware = { git = "https://github.com/valory-xyz/olas-operate-app.git", rev = "d6749a34c3fb41e00502b039b7e8726d6904e9ab"}
tqdm = "^4.67.1"

[tool.poetry.group.dev.dependencies]
Expand Down
15 changes: 13 additions & 2 deletions scripts/predict_trader/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,10 @@ def _parse_args() -> Any:
or staking_state == StakingState.EVICTED
)
_print_status("Is service staked?", _color_bool(is_staked, "Yes", "No"))
staking_program = config.staking_vars.get("STAKING_PROGRAM")
is_mm_staking = "mech_marketplace" in staking_program
if is_staked:
_print_status("Staking program", config.staking_vars.get("STAKING_PROGRAM")) # type: ignore
_print_status("Staking program", staking_program) # type: ignore
if staking_state == StakingState.STAKED:
_print_status("Staking state", staking_state.name)
elif staking_state == StakingState.EVICTED:
Expand Down Expand Up @@ -308,7 +310,16 @@ def _parse_args() -> Any:
abi=service_registry_token_utility_abi,
)

mech_contract_address = activity_checker_contract.functions.agentMech().call()
if is_mm_staking:
activity_checker_data = requests.get(MECH_CONTRACT_JSON_URL).json()
activity_checker_abi = activity_checker_data.get("abi", [])
mm_activity_checker_contract = w3.eth.contract(
address=activity_checker_address, abi=activity_checker_abi # type: ignore
)
mech_contract_address = mm_activity_checker_contract.functions.mechMarketplace().call()
else:
mech_contract_address = activity_checker_contract.functions.agentMech().call()

mech_contract_data = requests.get(MECH_CONTRACT_JSON_URL).json()

mech_contract_abi = mech_contract_data.get("abi", [])
Expand Down