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

Implement Multisend Transaction Capability #13

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ packages/valory/skills/*
!packages/valory/skills/learning_abci
!packages/valory/skills/learning_chained_abci
!packages/valory/contracts/erc20
!packages/valory/contracts/erc20_new

leak_report
/Pipfile.lock
Expand Down
35 changes: 18 additions & 17 deletions packages/packages.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"dev": {
"contract/valory/erc20/0.1.0": "bafybeibyhuxozkkvsymqz45vxixr3w3bs4vsvxg2nsx5jlyi3f3hhn7ezi",
"skill/valory/learning_abci/0.1.0": "bafybeih5m372dqrdfy7w6iah4m5qfgf3j5t7ihsgorzyzhax5srm32wmim",
"skill/valory/learning_chained_abci/0.1.0": "bafybeihu6uvvdnfntgluhrbxqus5malsit36xqsyxv46wjqsmuodadarpm",
"agent/valory/learning_agent/0.1.0": "bafybeiatizepnj42umexk3p5rnop67cdshbgrflvnysaagm3t4xqo74kem",
"service/valory/learning_service/0.1.0": "bafybeig34lg3wztyj7ecsbyb6qj7ryf34gnpr2cuoz3akjvgdsh3pejboq"
"contract/valory/erc20/0.1.0": "bafybeie7n4azsbr6i3wlovh5f3qmke6eh4l6zpualde2k2eej4imfyjtjm",
"contract/valory/erc20_new/0.1.0": "bafybeiey3hwc2rf4z3jx6r4jrjib75mqe4evnrzz7kfqg2lt5e22p24gwm",
"skill/valory/learning_abci/0.1.0": "bafybeiad3wcbxhupp5rv6mf4u7u2fdmnaq7asipz6n4z3rx3jm2mzgnj3u",
"skill/valory/learning_chained_abci/0.1.0": "bafybeig7c7ario6qkblkkvzux22afj3xufxpes2p7p3g453a4kzuxdlihq",
"agent/valory/learning_agent/0.1.0": "bafybeid72hbgejbyhsrthdvuzgvrfjrij76mmtnpzt5d7lfe3zib34umka",
"service/valory/learning_service/0.1.0": "bafybeib4h3lui72wec3uhgwqz7xmo7ohwj4vzghz7h573nxoyoc24dgdgq"
},
"third_party": {
"protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi",
Expand All @@ -15,21 +16,21 @@
"protocol/valory/acn/1.1.0": "bafybeidluaoeakae3exseupaea4i3yvvk5vivyt227xshjlffywwxzcxqe",
"protocol/valory/ipfs/0.1.0": "bafybeiftxi2qhreewgsc5wevogi7yc5g6hbcbo4uiuaibauhv3nhfcdtvm",
"protocol/valory/tendermint/0.1.0": "bafybeig4mi3vmlv5zpbjbfuzcgida6j5f2nhrpedxicmrrfjweqc5r7cra",
"contract/valory/service_registry/0.1.0": "bafybeihafe524ilngwzavkhwz4er56p7nyar26lfm7lrksfiqvvzo3kdcq",
"contract/valory/gnosis_safe_proxy_factory/0.1.0": "bafybeicpcpyurm7gxir2gnlsgzeirzomkhcbnzr5txk67zdf4mmg737rtu",
"contract/valory/service_registry/0.1.0": "bafybeidipx4cmchxdu5i2v67rno7muie7ckjhmasaj64tv2vtj4fveklxi",
"contract/valory/gnosis_safe_proxy_factory/0.1.0": "bafybeifr4xpmzeb5hvpgd6h4nxlsu3ef2c3f6l5bgs34vym5ok6vllwhmy",
"contract/valory/multisend/0.1.0": "bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y",
"contract/valory/gnosis_safe/0.1.0": "bafybeib375xmvcplw7ageic2np3hq4yqeijrvd5kl7rrdnyvswats6ngmm",
"connection/valory/abci/0.1.0": "bafybeiejymu4ul62zx6weoibnlsrfprfpjnplhjefz6sr6izgdr4sajlnu",
"contract/valory/gnosis_safe/0.1.0": "bafybeihtqcpqthb37msgqabpzcc2xc3l3yzkp5pl2sodeghqyzzzyuevgi",
"connection/valory/abci/0.1.0": "bafybeie2bc44r2ddspeg4v7minuievvjykomcukuf5ryevom6fajno25gy",
"connection/valory/http_client/0.23.0": "bafybeihi772xgzpqeipp3fhmvpct4y6e6tpjp4sogwqrnf3wqspgeilg4u",
"connection/valory/ipfs/0.1.0": "bafybeiegnapkvkamis47v5ioza2haerrjdzzb23rptpmcydyneas7jc2wm",
"connection/valory/ipfs/0.1.0": "bafybeias6633a2337nhq6nn5ikq4jaig47v63nxv2ixkjr6qqrqaywqara",
"connection/valory/ledger/0.19.0": "bafybeigntoericenpzvwejqfuc3kqzo2pscs76qoygg5dbj6f4zxusru5e",
"connection/valory/p2p_libp2p_client/0.1.0": "bafybeid3xg5k2ol5adflqloy75ibgljmol6xsvzvezebsg7oudxeeolz7e",
"connection/valory/p2p_libp2p_client/0.1.0": "bafybeihs5zlwa5wlozct3rjlxsirm3ve3e4buse5nfehiky6ymnnfrobne",
"connection/valory/http_server/0.22.0": "bafybeihpgu56ovmq4npazdbh6y6ru5i7zuv6wvdglpxavsckyih56smu7m",
"skill/valory/abstract_abci/0.1.0": "bafybeidz54kvxhbdmpruzguuzzq7bjg4pekjb5amqobkxoy4oqknnobopu",
"skill/valory/reset_pause_abci/0.1.0": "bafybeif4lgvbzsmzljesxbphycdv52ka7qnihyjrjpfaseclxadcmm6yiq",
"skill/valory/registration_abci/0.1.0": "bafybeiffipsowrqrkhjoexem7ern5ob4fabgif7wa6gtlszcoaop2e3oey",
"skill/valory/abstract_round_abci/0.1.0": "bafybeiajjzuh6vf23crp55humonknirvv2f4s3dmdlfzch6tc5ow52pcgm",
"skill/valory/termination_abci/0.1.0": "bafybeiekkpo5qef5zaeagm3si6v45qxcojvtjqe4a5ceccvk4q7k3xi3bi",
"skill/valory/transaction_settlement_abci/0.1.0": "bafybeielv6eivt2z6nforq43xewl2vmpfwpdu2s2vfogobziljnwsclmlm"
"skill/valory/abstract_abci/0.1.0": "bafybeif2naoydlrqkdpnig34uejedwgurjwyvmbpcz53tif7pyukfdophq",
"skill/valory/reset_pause_abci/0.1.0": "bafybeieqrlhorgogndimdbznuthw7krxgxdybqlqgzcdqwwomxp2wohx7u",
"skill/valory/registration_abci/0.1.0": "bafybeig7fgfy7wqyjmvti64s4jaqbc4p5egybxoieldbby4ipbtoztbs7u",
"skill/valory/abstract_round_abci/0.1.0": "bafybeifnixbpctjjngqm7fhfrdj3uuis3jn3cf57zhy3y2rdeojabvkm7e",
"skill/valory/termination_abci/0.1.0": "bafybeias735noxzov2ekoxzvi66sk4rv76bqhbs3zm5nwp5bkrzumnuj5m",
"skill/valory/transaction_settlement_abci/0.1.0": "bafybeib4uiek6kavfpx7pgcdsbp4ifgslknzm4vluarz57nqmvbudzz2hi"
}
}
44 changes: 29 additions & 15 deletions packages/valory/agents/learning_agent/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,19 @@ fingerprint:
__init__.py: bafybeie5m76ta46xggcm6dyxszq7ktm5jmcikgqoxho6sttnzvogn52zdq
fingerprint_ignore_patterns: []
connections:
- valory/abci:0.1.0:bafybeiejymu4ul62zx6weoibnlsrfprfpjnplhjefz6sr6izgdr4sajlnu
- valory/abci:0.1.0:bafybeie2bc44r2ddspeg4v7minuievvjykomcukuf5ryevom6fajno25gy
- valory/http_client:0.23.0:bafybeihi772xgzpqeipp3fhmvpct4y6e6tpjp4sogwqrnf3wqspgeilg4u
- valory/http_server:0.22.0:bafybeihpgu56ovmq4npazdbh6y6ru5i7zuv6wvdglpxavsckyih56smu7m
- valory/ipfs:0.1.0:bafybeiegnapkvkamis47v5ioza2haerrjdzzb23rptpmcydyneas7jc2wm
- valory/ipfs:0.1.0:bafybeias6633a2337nhq6nn5ikq4jaig47v63nxv2ixkjr6qqrqaywqara
- valory/ledger:0.19.0:bafybeigntoericenpzvwejqfuc3kqzo2pscs76qoygg5dbj6f4zxusru5e
- valory/p2p_libp2p_client:0.1.0:bafybeid3xg5k2ol5adflqloy75ibgljmol6xsvzvezebsg7oudxeeolz7e
- valory/p2p_libp2p_client:0.1.0:bafybeihs5zlwa5wlozct3rjlxsirm3ve3e4buse5nfehiky6ymnnfrobne
contracts:
- valory/gnosis_safe:0.1.0:bafybeib375xmvcplw7ageic2np3hq4yqeijrvd5kl7rrdnyvswats6ngmm
- valory/gnosis_safe_proxy_factory:0.1.0:bafybeicpcpyurm7gxir2gnlsgzeirzomkhcbnzr5txk67zdf4mmg737rtu
- valory/gnosis_safe:0.1.0:bafybeihtqcpqthb37msgqabpzcc2xc3l3yzkp5pl2sodeghqyzzzyuevgi
- valory/gnosis_safe_proxy_factory:0.1.0:bafybeifr4xpmzeb5hvpgd6h4nxlsu3ef2c3f6l5bgs34vym5ok6vllwhmy
- valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y
- valory/service_registry:0.1.0:bafybeihafe524ilngwzavkhwz4er56p7nyar26lfm7lrksfiqvvzo3kdcq
- valory/erc20:0.1.0:bafybeibyhuxozkkvsymqz45vxixr3w3bs4vsvxg2nsx5jlyi3f3hhn7ezi
- valory/service_registry:0.1.0:bafybeidipx4cmchxdu5i2v67rno7muie7ckjhmasaj64tv2vtj4fveklxi
- valory/erc20:0.1.0:bafybeie7n4azsbr6i3wlovh5f3qmke6eh4l6zpualde2k2eej4imfyjtjm
- valory/erc20_new:0.1.0:bafybeiey3hwc2rf4z3jx6r4jrjib75mqe4evnrzz7kfqg2lt5e22p24gwm
protocols:
- open_aea/signing:1.0.0:bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi
- valory/abci:0.1.0:bafybeiaqmp7kocbfdboksayeqhkbrynvlfzsx4uy4x6nohywnmaig4an7u
Expand All @@ -30,14 +31,14 @@ protocols:
- valory/ledger_api:1.0.0:bafybeihdk6psr4guxmbcrc26jr2cbgzpd5aljkqvpwo64bvaz7tdti2oni
- valory/tendermint:0.1.0:bafybeig4mi3vmlv5zpbjbfuzcgida6j5f2nhrpedxicmrrfjweqc5r7cra
skills:
- valory/abstract_abci:0.1.0:bafybeidz54kvxhbdmpruzguuzzq7bjg4pekjb5amqobkxoy4oqknnobopu
- valory/abstract_round_abci:0.1.0:bafybeiajjzuh6vf23crp55humonknirvv2f4s3dmdlfzch6tc5ow52pcgm
- valory/learning_abci:0.1.0:bafybeih5m372dqrdfy7w6iah4m5qfgf3j5t7ihsgorzyzhax5srm32wmim
- valory/learning_chained_abci:0.1.0:bafybeihu6uvvdnfntgluhrbxqus5malsit36xqsyxv46wjqsmuodadarpm
- valory/registration_abci:0.1.0:bafybeiffipsowrqrkhjoexem7ern5ob4fabgif7wa6gtlszcoaop2e3oey
- valory/reset_pause_abci:0.1.0:bafybeif4lgvbzsmzljesxbphycdv52ka7qnihyjrjpfaseclxadcmm6yiq
- valory/termination_abci:0.1.0:bafybeiekkpo5qef5zaeagm3si6v45qxcojvtjqe4a5ceccvk4q7k3xi3bi
- valory/transaction_settlement_abci:0.1.0:bafybeielv6eivt2z6nforq43xewl2vmpfwpdu2s2vfogobziljnwsclmlm
- valory/abstract_abci:0.1.0:bafybeif2naoydlrqkdpnig34uejedwgurjwyvmbpcz53tif7pyukfdophq
- valory/abstract_round_abci:0.1.0:bafybeifnixbpctjjngqm7fhfrdj3uuis3jn3cf57zhy3y2rdeojabvkm7e
- valory/learning_abci:0.1.0:bafybeiad3wcbxhupp5rv6mf4u7u2fdmnaq7asipz6n4z3rx3jm2mzgnj3u
- valory/learning_chained_abci:0.1.0:bafybeig7c7ario6qkblkkvzux22afj3xufxpes2p7p3g453a4kzuxdlihq
- valory/registration_abci:0.1.0:bafybeig7fgfy7wqyjmvti64s4jaqbc4p5egybxoieldbby4ipbtoztbs7u
- valory/reset_pause_abci:0.1.0:bafybeieqrlhorgogndimdbznuthw7krxgxdybqlqgzcdqwwomxp2wohx7u
- valory/termination_abci:0.1.0:bafybeias735noxzov2ekoxzvi66sk4rv76bqhbs3zm5nwp5bkrzumnuj5m
- valory/transaction_settlement_abci:0.1.0:bafybeib4uiek6kavfpx7pgcdsbp4ifgslknzm4vluarz57nqmvbudzz2hi
default_ledger: ethereum
required_ledgers:
- ethereum
Expand Down Expand Up @@ -219,3 +220,16 @@ models:
response_type: dict
retries: 5
url: https://api.coingecko.com/api/v3/simple/price
coingecko_pricehistorydata_specs:
args:
api_id: coingecko
headers:
Accept: application/json
method: GET
parameters:
vs_currency: usd
days: 1
response_key: prices
response_type: list
retries: 5
url: https://api.coingecko.com/api/v3/coins/autonolas/market_chart
12 changes: 12 additions & 0 deletions packages/valory/contracts/erc20/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@ def check_balance(
token_balance = balance_of(account).call()
wallet_balance = ledger_api.api.eth.get_balance(account)
return dict(token=token_balance, wallet=wallet_balance)

@classmethod
def totalSupply(
cls,
ledger_api: EthereumApi,
contract_address: str,
) -> JSONLike:
"""Check the totalSupply of the given ERC20 token"""
contract_instance = cls.get_instance(ledger_api, contract_address)
totalSupply = getattr(contract_instance.functions, "totalSupply") # noqa
token_totalSupply = totalSupply().call()
return dict(totalSupply=token_totalSupply)

@classmethod
def get_allowance(
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: bafybeidewckxjj6vaz7sphkpnjgmsyhi7v7hijaz44yu7vbsnv3znqj3wm
contract.py: bafybeigbsyiugfcamtu2meur4rtalc6zbzmacic5br2qny4gsx7yom2bbe
fingerprint_ignore_patterns: []
contracts: []
class_name: ERC20
Expand Down
1 change: 1 addition & 0 deletions packages/valory/contracts/erc20_new/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# ERC20 token contract
20 changes: 20 additions & 0 deletions packages/valory/contracts/erc20_new/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2023-2024 Valory AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ------------------------------------------------------------------------------

"""This module contains the support resources for an ERC20 token."""
Loading