Skip to content
This repository was archived by the owner on May 29, 2025. It is now read-only.

Commit 3f12eea

Browse files
Merge pull request #341 from valory-xyz/develop
Release v0.19.2
2 parents 0f613d2 + 9123bcb commit 3f12eea

File tree

5 files changed

+186
-99
lines changed

5 files changed

+186
-99
lines changed

README.md

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Do you want to use staking in this service? (yes/no): n
4848
> Using this code could potentially lead to loss of funds, compromised data, or asset risk.
4949
> Exercise caution and use this code at your own risk. Please refer to the [LICENSE](./LICENSE) file for details about the terms and conditions.
5050
51-
Before you proceed, ensure you have at least 20 OLAS on Gnosis Chain. For more information on staking, checkout the following [blogpost](https://www.valory.xyz/post/alpine).
51+
Each staking program has different OLAS requirements. The script will check that your owner address meets the minimum required OLAS on the Gnosis Chain.
5252

5353
Clone this repository locally and execute:
5454

@@ -57,23 +57,46 @@ chmod +x run_service.sh
5757
./run_service.sh
5858
```
5959

60-
Answer 'Yes' when prompted:
60+
Select your preferred staking program when prompted:
6161

6262
```text
63-
Do you want to use staking in this service? (yes/no): y
63+
Please, select your staking program preference
64+
----------------------------------------------
65+
1) No staking
66+
Your Olas Predict agent will still actively participate in prediction
67+
markets, but it will not be staked within any staking program.
68+
69+
2) Quickstart Beta - Hobbyist
70+
The Quickstart Beta - Hobbyist staking contract offers 100 slots for
71+
operators running Olas Predict agents with the quickstart. It is designed as
72+
a step up from Coastal Staker Expeditions, requiring 100 OLAS for staking.
73+
The rewards are also more attractive than with Coastal Staker Expeditions.
74+
75+
3) Quickstart Beta - Expert
76+
The Quickstart Beta - Expert staking contract offers 20 slots for operators
77+
running Olas Predict agents with the quickstart. It is designed for
78+
professional agent operators, requiring 1000 OLAS for staking. The rewards
79+
are proportional to the Quickstart Beta - Hobbyist.
6480
```
6581

66-
Find below a diagram of the possible status a service can be in the **Alpine staking** program:
82+
Find below a diagram of the possible status a service can be in the staking program:
6783

68-
![Alpine staking FSM](images/alpine_staking_fsm.svg)
84+
![Staking FSM](images/staking_fsm.svg)
6985

70-
Services can become staked by invoking the `stake()` contract method, where service parameters and deposit amounts are verified. Staked services can call the `checkpoint()` method at regular intervals, ensuring liveness checks and calculating staking incentives. In case a service remains inactive beyond the specified `maxAllowedInactivity` time, it faces eviction from the staking program, ceasing to accrue additional rewards. Staked or evicted services can unstaked by calling the `unstake()` contract method. They can do so after `minStakingDuration` has passed or if no more staking rewards are available.
86+
Services can become staked by invoking the `stake()` contract method, where service parameters and deposit amounts are verified. Staked services can call the `checkpoint()` method at regular intervals, ensuring liveness checks and calculating staking rewards. In case a service remains inactive beyond the specified `maxAllowedInactivity` time, it faces eviction from the staking program, ceasing to accrue additional rewards. Staked or evicted services can be unstaked by calling the `unstake()` contract method. They can do so after `minStakingDuration` has passed or if no more staking rewards are available.
7187

7288
__Notes__:
7389

7490
- Staking is currently in a testing phase, so the number of trader agents that can be staked might be limited.
75-
- In the [Alpine staking program](https://www.valory.xyz/post/alpine) services are evicted after accumulating 2 consecutive checkpoints without meeting the activity threshold.
91+
- Services are evicted after accumulating 2 consecutive checkpoints without meeting the activity threshold.
7692
- Currently, the minimum staking time is approximately 3 days. In particular, a service cannot be unstaked during the minimum staking period.
93+
- Once a staking program is selected, you can reset your preference by stopping your agent by running ./stop_service.sh and then running the command
94+
95+
``` bash
96+
cd trader; poetry run python ../scripts/choose_staking.py --reset; cd ..
97+
```
98+
99+
Keep in mind that your service must stay for `minStakingDuration` in a staking program (typically 3 days) before you can change to a new program.
77100

78101
### Service is Running
79102

File renamed without changes.

run_service.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ if [ "$local_service_hash" != "$remote_service_hash" ] || [ "$on_chain_agent_id"
897897

898898
response="y"
899899
if [ "${USE_STAKING}" = true ]; then
900-
echo "Your service is in a staking program. Updating your on-chain service requires that it is first unstaked."
900+
echo "If your service is in a staking program, updating your on-chain service requires that it is first unstaked."
901901
echo "Unstaking your service will retrieve the accrued staking rewards."
902902
echo ""
903903
echo "Do you want to continue updating your service? (yes/no)"
@@ -909,9 +909,7 @@ if [ "$local_service_hash" != "$remote_service_hash" ] || [ "$on_chain_agent_id"
909909
echo "Skipping on-chain service update."
910910
else
911911
# unstake the service
912-
if [ "${USE_STAKING}" = true ]; then
913-
perform_staking_ops true
914-
fi
912+
perform_staking_ops true
915913

916914
# Check balances
917915
suggested_amount=$suggested_top_up_default
@@ -1133,7 +1131,7 @@ export STOP_TRADING_IF_STAKING_KPI_MET=true
11331131
export RESET_PAUSE_DURATION=45
11341132
export MECH_WRAPPED_NATIVE_TOKEN_ADDRESS=$WXDAI_ADDRESS
11351133
export MECH_CHAIN_ID=ethereum
1136-
export TOOLS_ACCURACY_HASH=QmexjVcbhh7sMAKmRtxLbgZiiGKdGpHHMYAWecVq7riAD1
1134+
export TOOLS_ACCURACY_HASH=QmZnwodYVedKYChEUtGVVCCw2FCYP9xPQFYK3yL7VHXkid
11371135

11381136
if [ -n "$SUBGRAPH_API_KEY" ]; then
11391137
export CONDITIONAL_TOKENS_SUBGRAPH_URL="https://gateway-arbitrum.network.thegraph.com/api/$SUBGRAPH_API_KEY/subgraphs/id/7s9rGBffUTL8kDZuxvvpuc46v44iuDarbrADBFw5uVp2"

scripts/choose_staking.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -229,14 +229,14 @@ def _get_nevermined_env_variables() -> Dict[str, str]:
229229
use_nevermined = True
230230

231231
if use_nevermined:
232-
print("A Nevermined subscription will be used to pay for the mech requests.")
232+
print(" - A Nevermined subscription will be used to pay for the mech requests.")
233233
return {
234234
"MECH_CONTRACT_ADDRESS": NEVERMINED_MECH_CONTRACT_ADDRESS,
235235
"AGENT_REGISTRY_ADDRESS": NEVERMINED_AGENT_REGISTRY_ADDRESS,
236236
"MECH_REQUEST_PRICE": NEVERMINED_MECH_REQUEST_PRICE
237237
}
238238
else:
239-
print("No Nevermined subscription set.")
239+
print(" - No Nevermined subscription set.")
240240
return {
241241
"AGENT_REGISTRY_ADDRESS": "",
242242
"MECH_REQUEST_PRICE": ""
@@ -249,24 +249,35 @@ def main() -> None:
249249
args = parser.parse_args()
250250

251251
if args.reset:
252+
env_file_vars = dotenv_values(DOTENV_PATH)
253+
staking_program = env_file_vars.get("STAKING_PROGRAM")
254+
print("=====================================")
255+
print("Reset your staking program preference")
256+
print("=====================================")
257+
print("")
258+
print(f"Your current staking program is set to '{staking_program}'")
259+
response = input("Do you want to reset your staking program preference? (yes/no): ").strip().lower()
260+
if response not in ['yes', 'y']:
261+
return
262+
263+
print("")
252264
unset_key(dotenv_path=DOTENV_PATH, key_to_unset="USE_STAKING")
253265
unset_key(dotenv_path=DOTENV_PATH, key_to_unset="STAKING_PROGRAM")
254266
print(f"Environment variables USE_STAKING and STAKING_PROGRAM have been reset in '{DOTENV_PATH}'.")
255-
print("You can now execute './run_service.sh' and select a different staking program.")
256267
print("")
257-
return
258268

259269
program_id = _prompt_select_staking_program()
260270

261-
print("Populating staking program variables in the .env file")
262-
print("")
271+
print(" - Populating staking program variables in the .env file")
263272
staking_env_variables = _get_staking_env_variables(program_id)
264273
_set_dotenv_file_variables(staking_env_variables)
265274

266-
print("Populating Nevermined variables in the .env file")
275+
print(" - Populating Nevermined variables in the .env file")
267276
print("")
268277
nevermined_env_variables = _get_nevermined_env_variables()
269278
_set_dotenv_file_variables(nevermined_env_variables)
279+
print("")
280+
print("Finished populating the .env file.")
270281

271282

272283
if __name__ == "__main__":

0 commit comments

Comments
 (0)