Skip to content

Commit

Permalink
Merge pull request #58 from valory-xyz/fix/minor-fixes
Browse files Browse the repository at this point in the history
fix: add minor fixes
  • Loading branch information
Divya-Solulab authored Jan 8, 2025
2 parents 2710166 + 842e2be commit 937d009
Show file tree
Hide file tree
Showing 13 changed files with 330 additions and 223 deletions.
14 changes: 7 additions & 7 deletions packages/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
"dev": {
"custom/valory/merkl_pools_search/0.1.0": "bafybeibywngxfy5e2crtkvgfvad2ciepg3qk3h54eg3vbjoxwvf2j55wzq",
"custom/valory/asset_lending/0.1.0": "bafybeihsq7hhdgcc5wqxbqrioxaqsrza4424wqlv3hqkemomsb337pocki",
"custom/valory/max_apr_selection/0.1.0": "bafybeigalst3ygzbu5s2d4hbhpnwdzzxu2xgvegqhpw5bckem7z5kl33vq",
"custom/valory/max_apr_selection/0.1.0": "bafybeih255rl4tnom2gvg2b3t2glpgcgck3orrerbhmayd7cbnggglbh7e",
"custom/valory/balancer_pools_search/0.1.0": "bafybeievabkqmmpq252giacmdlxl5kk5r3qdl6rdnh4iwkx3fzsqvkejwm",
"custom/valory/uniswap_pools_search/0.1.0": "bafybeiaqkkpgzx7krvgu7xhbe65mgtq7vyhkx4rztny7qcczrjonxc3uwm",
"contract/valory/balancer_weighted_pool/0.1.0": "bafybeib755ksie5yv4wn6jl7i3bpshlhscf4bzsabqrbahm6b3m5ixzmbi",
"contract/valory/balancer_vault/0.1.0": "bafybeidgdivmrm77yotgpnn567ayzhoqa6hufrijy2cj2b7w5wa63otzq4",
"contract/valory/erc20/0.1.0": "bafybeibfznrdex34d5tta33eaicsv4sf7jibw6zzl25rptj6wrghdc77xm",
"contract/valory/erc20/0.1.0": "bafybeifl3yoh66uwdyfzz65ed4dnc7gyhvvgcmzxjm4exhkupvurhjcb6m",
"contract/valory/uniswap_v3_non_fungible_position_manager/0.1.0": "bafybeiht7qjxkamjmq22o74f5faz3wqpb3cx2grl2t4zc2zxqjkzitc22a",
"contract/valory/uniswap_v3_pool/0.1.0": "bafybeiei7hmod5t7rzqsjb46jm7o4di2venanuktck2jvc4tiq7beso7ha",
"contract/valory/uniswap_v3_pool/0.1.0": "bafybeia2pkvje5lcqdwmvltu4v5qyxamj6icswxftufu3wamxdm4w7nz3q",
"contract/valory/merkl_distributor/0.1.0": "bafybeiegvzycswa7kdimhnjvhrtbrzu3zycnianhrdizq5i53ql7jf5poa",
"contract/valory/staking_token/0.1.0": "bafybeic4ug4p22q4hsh5z4hhjrishvnswino2fsleqsgdxlusd5h2x5hwy",
"contract/valory/staking_activity_checker/0.1.0": "bafybeidziyf4o763sw3fqlqjbpz3thrupuwx44barj72zj7tjnxbvkhoxa",
"contract/valory/sturdy_yearn_v3_vault/0.1.0": "bafybeieruhikfob2lporaysckr63y2ynvtqeqadoi2e3olddzv4rhtrwkm",
"skill/valory/liquidity_trader_abci/0.1.0": "bafybeih4m3ytez26sd62j7krsfmvwpnibsdam4ttvhjsyppdgo77pl7gde",
"skill/valory/optimus_abci/0.1.0": "bafybeigriqe37hnh2fv72q5rtavj75ejjqdjuwapqdgpcpqcyhxks5ug5q",
"agent/valory/optimus/0.1.0": "bafybeid6kyiabhadvzxkinomkyo4h664qxplmmpb4ksquqkgq36h5ffyfa",
"service/valory/optimus/0.1.0": "bafybeiecfjuj3s34wsn2tavzblkvqow43oj3ljmtfueikkyql7r5e3gl7m"
"skill/valory/liquidity_trader_abci/0.1.0": "bafybeiehsxe2cx37pxsdkj4jfwf2csv4lqlvkzkvh4cefqtdileoglybry",
"skill/valory/optimus_abci/0.1.0": "bafybeie45glxsqdosjvsxqky6sghda36aj2dw4wmnpf5jimjfmwbq54vji",
"agent/valory/optimus/0.1.0": "bafybeigyhmkkpf6adlkwuj7zz66pynopzugxehaatvchkjelyik4juzydi",
"service/valory/optimus/0.1.0": "bafybeidcn6h5q7cu56bs7k6zdxi4oatsoio7gmnronpprerzqmqj66xf2e"
},
"third_party": {
"protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi",
Expand Down
17 changes: 9 additions & 8 deletions packages/valory/agents/optimus/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ contracts:
- valory/balancer_weighted_pool:0.1.0:bafybeib755ksie5yv4wn6jl7i3bpshlhscf4bzsabqrbahm6b3m5ixzmbi
- valory/balancer_vault:0.1.0:bafybeidgdivmrm77yotgpnn567ayzhoqa6hufrijy2cj2b7w5wa63otzq4
- valory/uniswap_v3_non_fungible_position_manager:0.1.0:bafybeiht7qjxkamjmq22o74f5faz3wqpb3cx2grl2t4zc2zxqjkzitc22a
- valory/uniswap_v3_pool:0.1.0:bafybeiei7hmod5t7rzqsjb46jm7o4di2venanuktck2jvc4tiq7beso7ha
- valory/uniswap_v3_pool:0.1.0:bafybeia2pkvje5lcqdwmvltu4v5qyxamj6icswxftufu3wamxdm4w7nz3q
- valory/sturdy_yearn_v3_vault:0.1.0:bafybeieruhikfob2lporaysckr63y2ynvtqeqadoi2e3olddzv4rhtrwkm
protocols:
- open_aea/signing:1.0.0:bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi
Expand All @@ -36,15 +36,15 @@ protocols:
skills:
- valory/abstract_abci:0.1.0:bafybeif2naoydlrqkdpnig34uejedwgurjwyvmbpcz53tif7pyukfdophq
- valory/abstract_round_abci:0.1.0:bafybeigjddhk7epta7xpnfvv426xedff5abh4xlkwi6cqgp4vkutgkvydm
- valory/liquidity_trader_abci:0.1.0:bafybeih4m3ytez26sd62j7krsfmvwpnibsdam4ttvhjsyppdgo77pl7gde
- valory/optimus_abci:0.1.0:bafybeigriqe37hnh2fv72q5rtavj75ejjqdjuwapqdgpcpqcyhxks5ug5q
- valory/liquidity_trader_abci:0.1.0:bafybeiehsxe2cx37pxsdkj4jfwf2csv4lqlvkzkvh4cefqtdileoglybry
- valory/optimus_abci:0.1.0:bafybeie45glxsqdosjvsxqky6sghda36aj2dw4wmnpf5jimjfmwbq54vji
- valory/registration_abci:0.1.0:bafybeiagi6e2h7kochmlemy5c5yk6hwn37tfxiqvk2en74jhowsdwlmrny
- valory/reset_pause_abci:0.1.0:bafybeiezfedmmseox3ce5aucxsiszdmvskrwwbtpb2a3vw3sbmc5jt7nri
- valory/termination_abci:0.1.0:bafybeiea67epwwgngp7b3wavs6hpkaxv6etyaps6g6325bchfnf354mibq
- valory/transaction_settlement_abci:0.1.0:bafybeifmgmwdkx4esemxjacjwzqkqymkuklb5nehkwqkx7v335fllgswcq
customs:
- valory/merkl_pools_search:0.1.0:bafybeibywngxfy5e2crtkvgfvad2ciepg3qk3h54eg3vbjoxwvf2j55wzq
- valory/max_apr_selection:0.1.0:bafybeigalst3ygzbu5s2d4hbhpnwdzzxu2xgvegqhpw5bckem7z5kl33vq
- valory/max_apr_selection:0.1.0:bafybeih255rl4tnom2gvg2b3t2glpgcgck3orrerbhmayd7cbnggglbh7e
- valory/balancer_pools_search:0.1.0:bafybeievabkqmmpq252giacmdlxl5kk5r3qdl6rdnh4iwkx3fzsqvkejwm
- valory/uniswap_pools_search:0.1.0:bafybeiaqkkpgzx7krvgu7xhbe65mgtq7vyhkx4rztny7qcczrjonxc3uwm
- valory/asset_lending:0.1.0:bafybeihsq7hhdgcc5wqxbqrioxaqsrza4424wqlv3hqkemomsb337pocki
Expand Down Expand Up @@ -105,12 +105,12 @@ config:
poa_chain: ${bool:false}
default_gas_price_strategy: ${str:eip1559}
optimism:
address: ${str:https://virtual.optimism.rpc.tenderly.co/3baf4a62-2fa9-448a-91a6-5f6ab95c76be}
address: ${str:https://mainnet.optimism.io/}
chain_id: ${int:10}
poa_chain: ${bool:false}
default_gas_price_strategy: ${str:eip1559}
mode:
address: ${str:https://virtual.mode.rpc.tenderly.co/f1d63db5-da55-4383-bbed-54a6edbb0ee2}
address: ${str:https://mainnet.mode.network}
chain_id: ${int:34443}
poa_chain: ${bool:false}
default_gas_price_strategy: ${str:eip1559}
Expand Down Expand Up @@ -154,6 +154,7 @@ models:
requests_per_minute: ${int:30}
credits: ${int:10000}
rate_limited_code: ${int:429}
historical_price_endpoint: ${str:https://api.coingecko.com/api/v3/coins/{coin_id}/history?date={date}}
chain_to_platform_id_mapping: ${str:{"optimism":"optimistic-ethereum","base":"base","ethereum":"ethereum","mode":"mode"}}
params:
args:
Expand Down Expand Up @@ -258,9 +259,9 @@ models:
balancer_graphql_endpoints: ${str:{"optimism":"https://api.studio.thegraph.com/query/75376/balancer-optimism-v2/version/latest","base":"https://api.studio.thegraph.com/query/24660/balancer-base-v2/version/latest","mode":"https://api.studio.thegraph.com/query/75376/balancer-mode-v2/version/latest"}}
target_investment_chains: ${list:["optimism","mode"]}
staking_chain: ${str:""}
file_hash_to_strategies: ${str:{"bafybeibywngxfy5e2crtkvgfvad2ciepg3qk3h54eg3vbjoxwvf2j55wzq":"merkl_pools_search","bafybeigalst3ygzbu5s2d4hbhpnwdzzxu2xgvegqhpw5bckem7z5kl33vq":"max_apr_selection","bafybeievabkqmmpq252giacmdlxl5kk5r3qdl6rdnh4iwkx3fzsqvkejwm":"balancer_pools_search","bafybeiaqkkpgzx7krvgu7xhbe65mgtq7vyhkx4rztny7qcczrjonxc3uwm":"uniswap_pools_search","bafybeihsq7hhdgcc5wqxbqrioxaqsrza4424wqlv3hqkemomsb337pocki":"asset_lending"}}
file_hash_to_strategies: ${str:{"bafybeibywngxfy5e2crtkvgfvad2ciepg3qk3h54eg3vbjoxwvf2j55wzq":"merkl_pools_search","bafybeih255rl4tnom2gvg2b3t2glpgcgck3orrerbhmayd7cbnggglbh7e":"max_apr_selection","bafybeievabkqmmpq252giacmdlxl5kk5r3qdl6rdnh4iwkx3fzsqvkejwm":"balancer_pools_search","bafybeiaqkkpgzx7krvgu7xhbe65mgtq7vyhkx4rztny7qcczrjonxc3uwm":"uniswap_pools_search","bafybeihsq7hhdgcc5wqxbqrioxaqsrza4424wqlv3hqkemomsb337pocki":"asset_lending"}}
strategies_kwargs: ${str:{"merkl_pools_search":{"balancer_graphql_endpoints":{"optimism":"https://api.studio.thegraph.com/query/75376/balancer-optimism-v2/version/latest","base":"https://api.studio.thegraph.com/query/24660/balancer-base-v2/version/latest","mode":"https://api.studio.thegraph.com/query/75376/balancer-mode-v2/version/latest"},"merkl_fetch_campaign_args":{"url":"https://api.merkl.xyz/v3/campaigns","creator":"","live":"false"}},"uniswap_pools_search":{"graphql_endpoints":{"optimism":"https://gateway.thegraph.com/api/575c6d9779719bc1ced85444c98441be/subgraphs/id/7SVwgBfXoWmiK6x1NF1VEo1szkeWLniqWN1oYsX3UMb5","base":"https://gateway.thegraph.com/api/575c6d9779719bc1ced85444c98441be/subgraphs/id/GqzP4Xaehti8KSfQmv3ZctFSjnSUYZ4En5NRsiTbvZpz"}},"balancer_pools_search":{"graphql_endpoint":"https://api-v3.balancer.fi/"},"asset_lending":{"endpoint":"https://us-central1-stu-dashboard-a0ba2.cloudfunctions.net/v2Aggregators","lending_asset":"0x4200000000000000000000000000000000000006"}}}
selected_strategies: ${list:["asset_lending","balancer_pools_search","uniswap_pools_search"]}
selected_strategies: ${list:["asset_lending","balancer_pools_search"]}
selected_protocols: ${list:["BALANCER","UNISWAP_V3","STURDY"]}
selected_hyper_strategy: ${str:max_apr_selection}
service_endpoint_base: ${str:https://optimus.staging.autonolas.tech/}
Expand Down
11 changes: 11 additions & 0 deletions packages/valory/contracts/erc20/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,17 @@ def get_total_supply(
total_supply = contract_instance.functions.totalSupply().call()
return dict(data=total_supply)

@classmethod
def get_name(
cls,
ledger_api: EthereumApi,
contract_address: str,
) -> JSONLike:
"""Get the total supply."""
contract_instance = cls.get_instance(ledger_api, contract_address)
name = contract_instance.functions.name().call()
return dict(data=name)

@classmethod
def get_token_decimals(
cls,
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/contracts/erc20/contract.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fingerprint:
README.md: bafybeifmfma6rglvpa22odtozyosnp5mwljum64utxip2wgmezuhnjjjyi
__init__.py: bafybeif5vpc3dfrlxlch7brbhmdwksabyzddpfqgm56vdbbkek3t3br6ke
build/ERC20.json: bafybeiemn5b5nszuss7xj6lmvmjuendltp6wz7ubihdvd7c6wqw4bohbpa
contract.py: bafybeihmjn3nmudmcf4ogmvqdgezodkv7vrn3jrgr5fft35djwulkhjm74
contract.py: bafybeicberios6nbxo5dsaa7aq2w4zho6xrpydnnfczdhxfhteygqnaagm
fingerprint_ignore_patterns: []
contracts: []
class_name: ERC20
Expand Down
14 changes: 8 additions & 6 deletions packages/valory/contracts/uniswap_v3_pool/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,12 @@ def get_reserves_and_balances(
current_token1_qty = reserves[1] * pool_share

return dict(
reserve0=reserves[0],
reserve1=reserves[1],
total_supply=total_supply,
your_lp_balance=your_lp_balance,
current_token0_qty=current_token0_qty,
current_token1_qty=current_token1_qty
data = {
"reserve0": reserves[0],
"reserve1": reserves[1],
"total_supply": total_supply,
"lp_balance": your_lp_balance,
"current_token0_qty": current_token0_qty,
"current_token1_qty": current_token1_qty
}
)
2 changes: 1 addition & 1 deletion packages/valory/contracts/uniswap_v3_pool/contract.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ aea_version: '>=1.0.0, <2.0.0'
fingerprint:
__init__.py: bafybeihdocjce5kvnpad5xhrc2ad7i3gftajix5z6f4zhpvmnk6blsmlza
build/UniswapV3Pool.json: bafybeids5lo3axsd6aplyywwi43xwdxj3njnrke5m7gsp3mg74svcodr4i
contract.py: bafybeiflyfrvqyt64qknlxcvqvkmcj35zbahsqfw5hj3ixwfqhlfzafaa4
contract.py: bafybeif7usloqdqdxe7cxh5qscfhprebc7iarcd64labglkujbcsprddyi
fingerprint_ignore_patterns: []
contracts: []
class_name: UniswapV3PoolContract
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/customs/max_apr_selection/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license: Apache-2.0
aea_version: '>=1.0.0, <2.0.0'
fingerprint:
__init__.py: bafybeiebxffqdqb67sa4w2xmmo5q3bnjflr2xeu4xsx3ynrsepf5js2cja
max_apr_selection.py: bafybeidraviyh7mqgdhhbaiexqyxsxbeg3hxnrxxisgwzgzoxfr6bok4lu
max_apr_selection.py: bafybeicxbtukzzx3xww73zcxrr3uo2cynt4bxxr5gjqcxia7prrfkvmu3m
fingerprint_ignore_patterns: []
entry_point: max_apr_selection.py
callable: run
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ def apply_risk_thresholds_and_select_optimal_strategy(trading_opportunities, cur
if better_opportunities:
# Sort and select the top opportunity
better_opportunities.sort(key=lambda x: x["composite_score"], reverse=True)
optimal_opportunities = [better_opportunities[0]] # Return as a list
optimal_opportunities = [better_opportunities[0]]
optimal_opportunities[0]["relative_funds_percentage"] = 1.0
_logger.info(f"Top opportunity found with composite score: {optimal_opportunities[0]['composite_score']}")
else:
_logger.warning(f"No opportunities significantly better than the least performing current opportunity with composite score: {least_performing_score}")
Expand Down
4 changes: 2 additions & 2 deletions packages/valory/services/optimus/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ aea_version: '>=1.0.0, <2.0.0'
license: Apache-2.0
fingerprint: {}
fingerprint_ignore_patterns: []
agent: valory/optimus:0.1.0:bafybeid6kyiabhadvzxkinomkyo4h664qxplmmpb4ksquqkgq36h5ffyfa
agent: valory/optimus:0.1.0:bafybeigyhmkkpf6adlkwuj7zz66pynopzugxehaatvchkjelyik4juzydi
number_of_agents: 1
deployment:
agent:
Expand Down Expand Up @@ -94,7 +94,7 @@ models:
target_investment_chains: ${TARGET_INVESTMENT_CHAINS:list:["base","optimism","mode"]}
staking_chain: ${STAKING_CHAIN:str:""}
initial_assets: ${INITIAL_ASSETS:str:{"ethereum":{"0x0000000000000000000000000000000000000000":"ETH","0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48":"USDC"}}}
file_hash_to_strategies: ${FILE_HASH_TO_STRATEGIES:str:{"bafybeibywngxfy5e2crtkvgfvad2ciepg3qk3h54eg3vbjoxwvf2j55wzq":"merkl_pools_search","bafybeigalst3ygzbu5s2d4hbhpnwdzzxu2xgvegqhpw5bckem7z5kl33vq":"max_apr_selection","bafybeievabkqmmpq252giacmdlxl5kk5r3qdl6rdnh4iwkx3fzsqvkejwm":"balancer_pools_search","bafybeiaqkkpgzx7krvgu7xhbe65mgtq7vyhkx4rztny7qcczrjonxc3uwm":"uniswap_pools_search","bafybeihsq7hhdgcc5wqxbqrioxaqsrza4424wqlv3hqkemomsb337pocki":"asset_lending"}}
file_hash_to_strategies: ${FILE_HASH_TO_STRATEGIES:str:{"bafybeibywngxfy5e2crtkvgfvad2ciepg3qk3h54eg3vbjoxwvf2j55wzq":"merkl_pools_search","bafybeih255rl4tnom2gvg2b3t2glpgcgck3orrerbhmayd7cbnggglbh7e":"max_apr_selection","bafybeievabkqmmpq252giacmdlxl5kk5r3qdl6rdnh4iwkx3fzsqvkejwm":"balancer_pools_search","bafybeiaqkkpgzx7krvgu7xhbe65mgtq7vyhkx4rztny7qcczrjonxc3uwm":"uniswap_pools_search","bafybeihsq7hhdgcc5wqxbqrioxaqsrza4424wqlv3hqkemomsb337pocki":"asset_lending"}}
strategies_kwargs: ${STRATEGIES_KWARGS:str:{"merkl_pools_search":{"balancer_graphql_endpoints":{"optimism":"https://api.studio.thegraph.com/query/75376/balancer-optimism-v2/version/latest","base":"https://api.studio.thegraph.com/query/24660/balancer-base-v2/version/latest","mode":"https://api.studio.thegraph.com/query/75376/balancer-mode-v2/version/latest"},"merkl_fetch_campaign_args":{"url":"https://api.merkl.xyz/v3/campaigns","creator":"","live":"false"}},"uniswap_pools_search":{"graphql_endpoints":{"optimism":"https://gateway.thegraph.com/api/575c6d9779719bc1ced85444c98441be/subgraphs/id/7SVwgBfXoWmiK6x1NF1VEo1szkeWLniqWN1oYsX3UMb5","base":"https://gateway.thegraph.com/api/575c6d9779719bc1ced85444c98441be/subgraphs/id/7SVwgBfXoWmiK6x1NF1VEo1szkeWLniqWN1oYsX3UMb5"}},"balancer_pools_search":{"graphql_endpoint":"https://api-v3.balancer.fi/"},"asset_lending":{"endpoint":"https://us-central1-stu-dashboard-a0ba2.cloudfunctions.net/v2Aggregators","lending_asset":"0x4200000000000000000000000000000000000006"}}
selected_strategies: ${SELECTED_STRATEGIES:list:["asset_lending","balancer_pools_search","uniswap_pools_search"]}
selected_protocols: ${SELECTED_PROTOCOLS:list:["BALANCER","UNISWAP_V3"]}
Expand Down
Loading

0 comments on commit 937d009

Please sign in to comment.