Skip to content

Commit d532de5

Browse files
Merge pull request #65 from valory-xyz/feat/conc-babydegen
Feat/conc babydegen
2 parents a7dda0a + 8c2e5be commit d532de5

35 files changed

+3386
-1318
lines changed
+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Temporary Push Docker Images
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
branch:
7+
description: 'Branch to build from'
8+
required: true
9+
default: 'main'
10+
push:
11+
tags:
12+
- 'dev.*'
13+
pull_request:
14+
branches:
15+
- main
16+
17+
jobs:
18+
publish-packages:
19+
name: Push Packages
20+
runs-on: ubuntu-20.04
21+
strategy:
22+
matrix:
23+
os: [ubuntu-latest]
24+
python-version: ["3.10"]
25+
steps:
26+
- uses: actions/checkout@v4
27+
- uses: actions/setup-python@v4
28+
with:
29+
python-version: ${{ matrix.python-versions }}
30+
- uses: addnab/docker-run-action@v3
31+
with:
32+
image: valory/open-autonomy-user:latest
33+
options: -v ${{ github.workspace }}:/work
34+
run: |
35+
echo "Pushing Packages"
36+
cd /work
37+
export AUTHOR=$(grep 'service' packages/packages.json | awk -F/ '{print $2}' | head -1)
38+
autonomy init --reset --author $AUTHOR --ipfs --remote
39+
autonomy push-all
40+
publish-images:
41+
name: Publish Docker Images
42+
runs-on: ubuntu-20.04
43+
needs:
44+
- "publish-packages"
45+
strategy:
46+
matrix:
47+
os: [ubuntu-latest]
48+
python-version: ["3.10"]
49+
env:
50+
DOCKER_USER: ${{secrets.DOCKER_USER}}
51+
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
52+
steps:
53+
- uses: actions/checkout@v4
54+
with:
55+
fetch-depth: 0
56+
- name: Set up tag and vars
57+
uses: addnab/docker-run-action@v3
58+
with:
59+
image: valory/open-autonomy-user:latest
60+
options: -v ${{ github.workspace }}:/work
61+
run: |
62+
echo "Setting Tag Images"
63+
cd /work
64+
apt-get update && apt-get install git -y || exit 1
65+
git config --global --add safe.directory /work
66+
export TAG=$(git describe --exact-match --tags $(git rev-parse HEAD)) || exit 1
67+
if [ $? -eq 0 ]; then
68+
export TAG=`echo $TAG | sed 's/^v//'`
69+
else
70+
echo "You are not on a tagged branch"
71+
exit 1
72+
fi
73+
echo VERSION=$TAG> env.sh
74+
echo AUTHOR=$(grep 'service/' packages/packages.json | awk -F/ '{print $2}' | head -1) >> env.sh
75+
echo SERVICE=$(grep 'service/' packages/packages.json | awk -F/ '{print $3}' | head -1) >> env.sh
76+
echo AGENT=$(grep 'agent/' packages/packages.json | awk -F/ '{print $3}' | head -1) >> env.sh
77+
echo DEFAULT_IMAGE_TAG=$(cat packages/packages.json | grep agent/ | awk -F: '{print $2}' | tr -d '", ' | head -n 1) >> env.sh
78+
cat env.sh
79+
- uses: addnab/docker-run-action@v3
80+
name: Build Images
81+
with:
82+
image: valory/open-autonomy-user:latest
83+
options: -v ${{ github.workspace }}:/work
84+
shell: bash
85+
run: |
86+
echo "Building Docker Images"
87+
cd /work
88+
source env.sh || exit 1
89+
echo "Building images for $AUTHOR for service $SERVICE"
90+
autonomy init --reset --author $AUTHOR --ipfs --remote
91+
autonomy fetch $AUTHOR/$SERVICE --service --local || exit 1
92+
cd $SERVICE || exit 1
93+
autonomy build-image || exit 1
94+
autonomy build-image --version $VERSION || exit 1
95+
- name: Docker login
96+
run: |
97+
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USER --password-stdin
98+
- name: Docker Push
99+
run: |
100+
source env.sh
101+
echo "Pushing $DOCKER_USER/oar-$AGENT:$VERSION"
102+
echo "Pushing $DOCKER_USER/oar-$AGENT:$DEFAULT_IMAGE_TAG"
103+
docker push $DOCKER_USER/oar-$AGENT:$VERSION
104+
docker push $DOCKER_USER/oar-$AGENT:$DEFAULT_IMAGE_TAG

.gitignore

+51-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ packages/valory/contracts/multisend
2121
packages/valory/contracts/service_registry
2222
packages/valory/services/*
2323
packages/valory/protocols/*
24-
packages/valory/skills/*
2524

2625
!packages/valory/agents/optimus
2726
!packages/valory/services/optimus
@@ -35,4 +34,55 @@ keys.json
3534
ethereum_private_key.txt
3635
__pycache__/
3736
.env
37+
38+
.nix-venv
39+
.certs
40+
multisig_address
41+
multisig_vault
42+
*/keys.json
43+
*private_key.txt*
44+
packages/fetchai/
45+
packages/open_aea/
46+
47+
packages/valory/skills/abstract_abci/
48+
packages/valory/skills/abstract_round_abci/
49+
packages/valory/skills/registration_abci/
50+
packages/valory/skills/reset_pause_abci/
51+
packages/valory/skills/transaction_settlement_abci/
52+
packages/valory/skills/termination_abci/
53+
packages/valory/skills/ipfs_package_downloader/
54+
packages/valory/skills/market_data_fetcher_abci/
55+
packages/valory/skills/portfolio_tracker_abci/
56+
packages/valory/skills/strategy_evaluator_abci/
57+
packages/valory/skills/trader_decision_maker_abci
58+
packages/valory/customs/trend_following_strategy
59+
60+
packages/valory/protocols/*
61+
62+
.idea
63+
**/__pycache__/
64+
*.DS_Store
65+
66+
.mypy_cache
67+
/.tox/
68+
69+
keys.json
70+
leak_report
71+
72+
agent/
73+
solana_trader_service/
74+
75+
./solana_trader/
76+
77+
packages/valory/skills/transaction_settlement_abci/
78+
79+
solana_trader/
80+
!/packages/valory/agents/solana_trader/
81+
!/packages/valory/services/solana_trader/
82+
83+
node_modules/
84+
.env
85+
86+
packages/open_aea/protocols/signing
87+
packages/eightballer/*
3888
test_gas_costs.json

.gitleaksignore

+3
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,8 @@ c022bdff65530d1dc6a037b3d173e3989a51daec:packages/valory/skills/reset_pause_abci
269269
c022bdff65530d1dc6a037b3d173e3989a51daec:packages/valory/skills/strategy_evaluator_abci/skill.yaml:generic-api-key:101
270270
c022bdff65530d1dc6a037b3d173e3989a51daec:packages/valory/skills/trader_decision_maker_abci/skill.yaml:generic-api-key:76
271271
c022bdff65530d1dc6a037b3d173e3989a51daec:packages/valory/skills/transaction_settlement_abci/skill.yaml:generic-api-key:93
272+
34591764415f2fbc959e41feb4b7aaef733285aa:packages/valory/services/optimus_pearl/service.yaml:generic-api-key:44
273+
70f1bad61ecef39d2004e54b7ca396ebaaaa5531:packages/valory/contracts/staking_token/contract.yaml:generic-api-key:10
272274
62bdc4f7ebebea4695e415915e773fd680baeb26:packages/valory/contracts/staking_token/contract.yaml:generic-api-key:10
273275
9facfc7d521059db3121a88593230520c0108379:liquidityRiskAssesmentScript/uniswap_top1000_pool_liquidity_data.py:generic-api-key:5
274276
9facfc7d521059db3121a88593230520c0108379:liquidityRiskAssesmentScript/uniswap_per_pool_liquidity_data.py:generic-api-key:117
@@ -311,6 +313,7 @@ cc5bde9d62ea96c13e43eb119f7f59075b040a69:packages/valory/contracts/staking_token
311313
ef0373adb2f8798b63bb0c00d146fa4eaa70a579:packages/valory/contracts/staking_token/contract.yaml:generic-api-key:10
312314
fe1e5cf86d167b698b3df9d600a4c26f0cc45bae:packages/valory/contracts/staking_token/contract.yaml:generic-api-key:10
313315
f5eed62a1572bbea8452a5f50e1b65e16063c535:packages/valory/contracts/staking_token/contract.yaml:generic-api-key:10
316+
a52f7509a88af2f6c1639af36fae9ab83fdeb6bd:packages/valory/contracts/staking_token/contract.yaml:generic-api-key:10
314317
c379f8caf26cb073b97d4e32c4e0b59cedbe0316:packages/valory/contracts/staking_token/contract.yaml:generic-api-key:10
315318
a52f7509a88af2f6c1639af36fae9ab83fdeb6bd:packages/valory/contracts/staking_token/contract.yaml:generic-api-key:10
316319
eceac088cd3b7eec763cde770671a63b9486c246:packages/valory/contracts/staking_token/contract.yaml:generic-api-key:10

Merge_Readme.md

+179
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
# Run Your Own Agent
2+
3+
This guide will help you set up and run your own agent, either **Optimus** or **BabyDegen**. Follow the steps below to get started.
4+
5+
---
6+
7+
## Table of Contents
8+
9+
1. [Get the Code](#1-get-the-code)
10+
2. [Set Up the Virtual Environment](#2-set-up-the-virtual-environment)
11+
3. [Synchronize Packages](#3-synchronize-packages)
12+
4. [Prepare the Data](#4-prepare-the-data)
13+
5. [Configure for Optimus](#5-configure-for-optimus)
14+
6. [Configure for BabyDegen](#6-configure-for-babydegen)
15+
7. [Run the Agent](#7-run-the-agent)
16+
17+
---
18+
19+
## 1. Get the Code
20+
21+
Clone the repository from GitHub:
22+
23+
```bash
24+
git clone https://github.com/valory-xyz/optimus.git
25+
```
26+
27+
---
28+
29+
## 2. Set Up the Virtual Environment
30+
31+
Navigate to the project directory and install the required dependencies using `poetry`:
32+
33+
```bash
34+
cd optimus
35+
poetry install
36+
poetry shell
37+
```
38+
39+
---
40+
41+
## 3. Synchronize Packages
42+
43+
Synchronize the necessary packages:
44+
45+
```bash
46+
autonomy packages sync --update-packages
47+
```
48+
49+
---
50+
51+
## 4. Prepare the Data
52+
53+
### Generate Wallet Keys
54+
55+
Create a `keys.json` file containing wallet addresses and private keys for four agents:
56+
57+
```bash
58+
autonomy generate-key ethereum -n 1
59+
```
60+
61+
### Create Ethereum Private Key File
62+
63+
Extract one of the private keys from `keys.json` and save it in a file named `ethereum_private_key.txt`. Ensure there's **no newline at the end of the file**.
64+
65+
---
66+
67+
## 5. Configure for Optimus
68+
69+
If you want to run the **Optimus** agent, follow these steps:
70+
71+
### a. Deploy Safe Contracts
72+
73+
Deploy [Safe](https://safe.global/) contracts on the following networks:
74+
75+
- Ethereum Mainnet
76+
- Optimism
77+
- Base
78+
79+
### b. Fund Your Safe and Agent Addresses
80+
81+
- **Safe Addresses**:
82+
- Deposit **ETH** and **USDC** into your Safe address on **Ethereum Mainnet**.
83+
- **Agent Addresses**:
84+
- Deposit **ETH** into your agent addresses on all networks (Ethereum Mainnet, Optimism, Base) to cover gas fees.
85+
86+
### c. Obtain API Keys
87+
88+
- **Tenderly**:
89+
- Access Key
90+
- Account Slug
91+
- Project Slug
92+
- Get them from your [Tenderly Dashboard](https://dashboard.tenderly.co/) under **Settings**.
93+
- **CoinGecko**:
94+
- API Key
95+
- Obtain it from your account's [Developer Dashboard](https://www.coingecko.com/account/dashboard).
96+
97+
### d. Create a `.env` File
98+
99+
Instead of exporting environment variables, create a `.env` file in your project directory and add the following configurations. Replace placeholder values with your actual data:
100+
101+
```dotenv
102+
PYTHONWARNINGS="ignore"
103+
ALL_PARTICIPANTS=["YOUR_AGENT_ADDRESS"]
104+
SAFE_CONTRACT_ADDRESSES='{
105+
"ethereum": "YOUR_SAFE_ADDRESS_ON_ETHEREUM",
106+
"optimism": "YOUR_SAFE_ADDRESS_ON_OPTIMISM",
107+
"base": "YOUR_SAFE_ADDRESS_ON_BASE"
108+
}'
109+
ETHEREUM_LEDGER_RPC=YOUR_ETHEREUM_RPC_URL
110+
OPTIMISM_LEDGER_RPC=YOUR_OPTIMISM_RPC_URL
111+
BASE_LEDGER_RPC=YOUR_BASE_RPC_URL
112+
MODE_LEDGER_RPC=
113+
SLIPPAGE_FOR_SWAP=0.09
114+
TENDERLY_ACCESS_KEY=YOUR_TENDERLY_ACCESS_KEY
115+
TENDERLY_ACCOUNT_SLUG=YOUR_TENDERLY_ACCOUNT_SLUG
116+
TENDERLY_PROJECT_SLUG=YOUR_TENDERLY_PROJECT_SLUG
117+
COINGECKO_API_KEY=YOUR_COINGECKO_API_KEY
118+
ALLOWED_CHAINS=["optimism","base"]
119+
```
120+
121+
---
122+
123+
## 6. Configure for BabyDegen
124+
125+
If you prefer to run the **BabyDegen** agent, follow these additional steps:
126+
127+
### a. Set the AGENT_TRANSITION Flag
128+
129+
Set the `AGENT_TRANSITION` flag to `true` in your `.env` file:
130+
131+
```dotenv
132+
AGENT_TRANSITION=true
133+
```
134+
135+
### b. Update Safe Address and Participants
136+
137+
Replace placeholders with your actual Safe address and agent address:
138+
139+
```dotenv
140+
SAFE_ADDRESS="YOUR_SAFE_ADDRESS"
141+
ALL_PARTICIPANTS=["YOUR_AGENT_ADDRESS"]
142+
```
143+
144+
### c. Fund the Safe Account
145+
146+
Deposit the following tokens into your Safe account, depending on the network:
147+
148+
```python
149+
LEDGER_TO_TOKEN_LIST = {
150+
SupportedLedgers.ETHEREUM: [
151+
"0x0001a500a6b18995b03f44bb040a5ffc28e45cb0", # Token A on Ethereum
152+
"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", # USDC on Ethereum
153+
"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", # WETH on Ethereum
154+
],
155+
SupportedLedgers.OPTIMISM: [
156+
"0x4200000000000000000000000000000000000006", # WETH on Optimism
157+
"0x0b2c639c533813f4aa9d7837caf62653d097ff85", # Token B on Optimism
158+
"0xda10009cbd5d07dd0cecc66161fc93d7c9000da1", # DAI on Optimism
159+
],
160+
SupportedLedgers.BASE: [
161+
"0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca", # Token C on Base
162+
"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", # Token D on Base
163+
],
164+
}
165+
```
166+
167+
### d. Fund the Agent Address
168+
169+
Ensure your agent address has enough native tokens to cover gas fees on your chosen network.
170+
171+
---
172+
173+
## 7. Run the Agent
174+
175+
After completing the setup for either **Optimus** or **BabyDegen**, run the agent using the provided script:
176+
177+
```bash
178+
bash run_agent.sh
179+
```

0 commit comments

Comments
 (0)