Skip to content

Commit

Permalink
Merge pull request #122 from valory-xyz/feat/staking
Browse files Browse the repository at this point in the history
Feat/staking
  • Loading branch information
DavidMinarsch authored Oct 31, 2023
2 parents bbc359b + 33ad976 commit 48aefd3
Show file tree
Hide file tree
Showing 13 changed files with 1,323 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitleaksignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ e601530b1b2503589126e99070459e3e46a789d5:packages/valory/skills/decision_maker_a
e601530b1b2503589126e99070459e3e46a789d5:packages/valory/skills/trader_abci/skill.yaml:generic-api-key:159
9150ab78d5e30f576226cf38fb4cc62d73b09752:packages/valory/contracts/conditional_tokens/contract.yaml:generic-api-key:10
cd8a3159e660a5eb6838657db4d7537912e657bf:packages/valory/skills/market_manager_abci/skill.yaml:generic-api-key:17
ce811dab0e95cdd63ea00e1ed8207801f464d773:packages/valory/contracts/service_staking_token/contract.yaml:generic-api-key:10
15 changes: 8 additions & 7 deletions packages/packages.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
{
"dev": {
"skill/valory/market_manager_abci/0.1.0": "bafybeigmy3g2klkzdhttti2ouxf575ua5y7ajmh4a3yfpukeukqxjky47m",
"skill/valory/decision_maker_abci/0.1.0": "bafybeichzmhpgyhk5gc6gepocdaghdwyoutq4x3ul4w7av4lasp7bxfb3y",
"skill/valory/trader_abci/0.1.0": "bafybeifrvvhiaioqqjzyouhi3ga37jk7ataxz5sox275mccqqszcsiehju",
"skill/valory/decision_maker_abci/0.1.0": "bafybeidzc26z7vudomj3gh7jyiain3erca2nejxxhl5v37rp22zfj5xwki",
"skill/valory/trader_abci/0.1.0": "bafybeieqfrs4qsazroxjeysbisvbdipnedkgt6ahgatq42rwnvadv74xku",
"contract/valory/market_maker/0.1.0": "bafybeif4mm2s3gxtvp227yypkcnna5ftec7vajcftvtbdmqddh7nprah5m",
"agent/valory/trader/0.1.0": "bafybeidfoajq7jno5ojcgvdkcacialgqr4rsayivkspjdyhcd2povbkiri",
"service/valory/trader/0.1.0": "bafybeihwzztpxd5g3pq5awpdtvbirdkwzt66bj26lpulzay2afsrzubfnq",
"contract/valory/erc20/0.1.0": "bafybeibysifjwhlcn7nntsjkowdmja53ed6urfzypi6sxfc7chtheecvpi",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeib5s5ubudn67phubygrx7lmlzfrhwhy4lo6biusef7ffk2jyipn6a",
"agent/valory/trader/0.1.0": "bafybeie2li4kyjchnbgdkntwhkfhvwllzp5h6kp5hsqzkumfykfhthbqui",
"service/valory/trader/0.1.0": "bafybeiakeiq4d7afhiaky2brwyum4i74e67ytvypcvlr4ij77f2teh7rwm",
"contract/valory/erc20/0.1.0": "bafybeieqj7dea4tcv6z2yqkgtmhd23vbiycsr5trhwxdvlbwulpl6vhmam",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeicoe4vpnminp2nwuyxbwcs2mnantvsgxrjfd7ogbgjkumuozotndy",
"contract/valory/mech/0.1.0": "bafybeifaavuqr2bz7nypapjwkufc5c6vwxm5ifucmtd3w7sh42tne35nga",
"contract/valory/realitio/0.1.0": "bafybeic3wihpzz4deguslpzlnsgrlrabclq3njwuagyaiiv6rzqujfrs6e",
"contract/valory/realitio_proxy/0.1.0": "bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4",
"contract/valory/conditional_tokens/0.1.0": "bafybeif5jwc6owfe6brmqq5sfnhrwo2ajdtt4glrmyhlqxcvtkyofahwsa",
"contract/valory/agent_registry/0.1.0": "bafybeifwdtwxdc2jdlhzdyxctqdmoz6zroxf5o4nhuok5l4luvnofqavty"
"contract/valory/agent_registry/0.1.0": "bafybeifwdtwxdc2jdlhzdyxctqdmoz6zroxf5o4nhuok5l4luvnofqavty",
"contract/valory/service_staking_token/0.1.0": "bafybeibifxmoeaiptovouispl5jdgm4lduzcfgsx723zlw45cfpllecuwy"
},
"third_party": {
"protocol/open_aea/signing/1.0.0": "bafybeie7xyems76v5b4wc2lmaidcujizpxfzjnnwdeokmhje53g7ym25ii",
Expand Down
8 changes: 4 additions & 4 deletions packages/valory/agents/trader/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ contracts:
- valory/gnosis_safe_proxy_factory:0.1.0:bafybeigxqwbd6wds57ecsfkl2hf4z4vbz5gokex6nutu5zcdpw6irh573y
- valory/service_registry:0.1.0:bafybeiebuuhs7fmigfh4c5dvzt6rbm5ekwrcnz7zouyjey7yyyqmpa6dyu
- valory/market_maker:0.1.0:bafybeif4mm2s3gxtvp227yypkcnna5ftec7vajcftvtbdmqddh7nprah5m
- valory/erc20:0.1.0:bafybeibysifjwhlcn7nntsjkowdmja53ed6urfzypi6sxfc7chtheecvpi
- valory/erc20:0.1.0:bafybeieqj7dea4tcv6z2yqkgtmhd23vbiycsr5trhwxdvlbwulpl6vhmam
- valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y
- valory/mech:0.1.0:bafybeifaavuqr2bz7nypapjwkufc5c6vwxm5ifucmtd3w7sh42tne35nga
- valory/conditional_tokens:0.1.0:bafybeif5jwc6owfe6brmqq5sfnhrwo2ajdtt4glrmyhlqxcvtkyofahwsa
Expand All @@ -41,10 +41,10 @@ skills:
- valory/reset_pause_abci:0.1.0:bafybeicpxn2khtaesuf4cq6ypwdmdmonlqroj2q2i6cxvpizc2y4cw66pe
- valory/termination_abci:0.1.0:bafybeieqm46zuccaagnko3qlw6p3nvoohdrfgvpmw467r5lyil2dqrzjsy
- valory/transaction_settlement_abci:0.1.0:bafybeia6cdxdlqrcwk2maw25fo7dafzd2p3rs7syropvufophk2pitzbwy
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeib5s5ubudn67phubygrx7lmlzfrhwhy4lo6biusef7ffk2jyipn6a
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeicoe4vpnminp2nwuyxbwcs2mnantvsgxrjfd7ogbgjkumuozotndy
- valory/market_manager_abci:0.1.0:bafybeigmy3g2klkzdhttti2ouxf575ua5y7ajmh4a3yfpukeukqxjky47m
- valory/decision_maker_abci:0.1.0:bafybeichzmhpgyhk5gc6gepocdaghdwyoutq4x3ul4w7av4lasp7bxfb3y
- valory/trader_abci:0.1.0:bafybeifrvvhiaioqqjzyouhi3ga37jk7ataxz5sox275mccqqszcsiehju
- valory/decision_maker_abci:0.1.0:bafybeidzc26z7vudomj3gh7jyiain3erca2nejxxhl5v37rp22zfj5xwki
- valory/trader_abci:0.1.0:bafybeieqfrs4qsazroxjeysbisvbdipnedkgt6ahgatq42rwnvadv74xku
default_ledger: ethereum
required_ledgers:
- ethereum
Expand Down
13 changes: 13 additions & 0 deletions packages/valory/contracts/erc20/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,19 @@ def check_balance(
wallet_balance = ledger_api.api.eth.get_balance(account)
return dict(token=token_balance, wallet=wallet_balance)

@classmethod
def get_allowance(
cls,
ledger_api: EthereumApi,
contract_address: str,
owner: str,
spender: str,
) -> JSONLike:
"""Check the balance of the given account."""
contract_instance = cls.get_instance(ledger_api, contract_address)
allowance = contract_instance.functions.allowance(owner, spender).call()
return dict(data=allowance)

@classmethod
def build_deposit_tx(
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: bafybeia2k2vmq7lmd3uchmm6jmzj7ebqkogk5aolpw4nwsawnkgqfobltm
build/ERC20.json: bafybeiemn5b5nszuss7xj6lmvmjuendltp6wz7ubihdvd7c6wqw4bohbpa
contract.py: bafybeigk7vgluyhpr65rllw4z5jrozjmrlufkxsfvnicuvpr5l5k3vmm6u
contract.py: bafybeif3vy43l7baa3doljavpfvy42mywkcgkvpvlilweluk5jf6e3doji
fingerprint_ignore_patterns: []
contracts: []
class_name: ERC20
Expand Down
20 changes: 20 additions & 0 deletions packages/valory/contracts/service_staking_token/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2023 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 the agent registry contract."""
Loading

0 comments on commit 48aefd3

Please sign in to comment.