Skip to content

Commit

Permalink
Merge pull request #36 from valory-xyz/feat/rmv-funds
Browse files Browse the repository at this point in the history
Feat/remove funds
  • Loading branch information
0xArdi authored Jul 31, 2023
2 parents 1e3a810 + 8e7f34b commit 4c74d73
Show file tree
Hide file tree
Showing 19 changed files with 1,505 additions and 88 deletions.
17 changes: 9 additions & 8 deletions packages/packages.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"dev": {
"contract/valory/conditional_tokens/0.1.0": "bafybeig5vtn7bzpegfrzehdgeezqcnox3xlb5i54ehnqndazhcfh3bkdcq",
"contract/valory/fpmm_deterministic_factory/0.1.0": "bafybeig4ztnqgyaespzlcmcom56nvmi4c4paddsxsjsh5q7olnylu3z7ou",
"contract/valory/realtio/0.1.0": "bafybeihoj7w5dqdyo6ds2rdmi326cvl5wuc7xp6yms7lwks35m4nqypk4q",
"skill/valory/market_creation_manager_abci/0.1.0": "bafybeibaovti3jrf5syhtffkgnj34agk4decoiybeufh4yb6qpvvtqycve",
"skill/valory/market_maker_abci/0.1.0": "bafybeibidkqzpqpx4cd2kil4f53ag32v4xyotxz5fn55iorgl7ylwdhcga",
"agent/valory/market_maker/0.1.0": "bafybeib4yddbk7kutldwubejzaqbscut7liwkwoncgepydaqbr3w7ztfaa",
"service/valory/market_maker/0.1.0": "bafybeigfi7bvtbqvvruherltjunkdlhsyxl3nlehno5nrbhvfgp4hizhhe",
"contract/valory/conditional_tokens/0.1.0": "bafybeibpzhbknohnx5mp653ky5betjfiz3ed3agj554oecsszqq4uxe4qi",
"contract/valory/fpmm_deterministic_factory/0.1.0": "bafybeif7hgwamqm6iljhtr32ap6eazn5yhmxrtlvicmpo746gv2s4tyzqq",
"contract/valory/realtio/0.1.0": "bafybeigsciwpawqiyxtk7klpnx6vyaz4nic5s6afl4eahab5ub4hftu4du",
"skill/valory/market_creation_manager_abci/0.1.0": "bafybeihavargx3sto43zh66zn7v5q7px7zgeebxq47gdfya66n2tqi6laa",
"skill/valory/market_maker_abci/0.1.0": "bafybeieu664wvp7pjnsvmg2dcuzej4tozseid74lvaflytwxtm57mu3kpu",
"agent/valory/market_maker/0.1.0": "bafybeifoxtvuyrtqisvq3tspmvt5sbft7deqxiw2gxreofre5aeo5finne",
"service/valory/market_maker/0.1.0": "bafybeicpjrjqgxhpxuweus3i3intu6kx2tdippcylxn5dr4zbq7dvbxogq",
"contract/valory/wxdai/0.1.0": "bafybeie3c5enerf54jt75xc62mbzck4kjqxpjx2mzo6v4rrz4dmcy4xdgy",
"skill/valory/market_validation_abci/0.1.0": "bafybeifyfwynotmzg6wypbzbwsfnrplhjhumfx32dm2j3ddasp7ygrfoqa"
"skill/valory/market_validation_abci/0.1.0": "bafybeifyfwynotmzg6wypbzbwsfnrplhjhumfx32dm2j3ddasp7ygrfoqa",
"contract/valory/fpmm/0.1.0": "bafybeihoczslmqbfpx57tmjps663r2ib7ycc3dfa4smdhufb4wbnidewtq"
},
"third_party": {
"protocol/valory/contract_api/1.0.0": "bafybeiasywsvax45qmugus5kxogejj66c5taen27h4voriodz7rgushtqa",
Expand Down
11 changes: 6 additions & 5 deletions packages/valory/agents/market_maker/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ contracts:
- valory/gnosis_safe:0.1.0:bafybeic3ajabs7sl6qgkzy452szlsdeitj746kdzfd7k4m4ixtxw4g33qi
- valory/gnosis_safe_proxy_factory:0.1.0:bafybeigbtbgzqlt4tufgymtjsyxiqvivxmtc4csx43hmo5nexmdfcxm6bi
- valory/multisend:0.1.0:bafybeict2k3vf3c4fvzosaq5kku2ivtzsskbomrujmmoicut7eg52onnje
- valory/realtio:0.1.0:bafybeihoj7w5dqdyo6ds2rdmi326cvl5wuc7xp6yms7lwks35m4nqypk4q
- valory/conditional_tokens:0.1.0:bafybeig5vtn7bzpegfrzehdgeezqcnox3xlb5i54ehnqndazhcfh3bkdcq
- valory/fpmm_deterministic_factory:0.1.0:bafybeig4ztnqgyaespzlcmcom56nvmi4c4paddsxsjsh5q7olnylu3z7ou
- valory/realtio:0.1.0:bafybeigsciwpawqiyxtk7klpnx6vyaz4nic5s6afl4eahab5ub4hftu4du
- valory/conditional_tokens:0.1.0:bafybeibpzhbknohnx5mp653ky5betjfiz3ed3agj554oecsszqq4uxe4qi
- valory/fpmm_deterministic_factory:0.1.0:bafybeif7hgwamqm6iljhtr32ap6eazn5yhmxrtlvicmpo746gv2s4tyzqq
- valory/service_registry:0.1.0:bafybeiae7nr5fqn6ckt3ehol27qfd4o5ljzx6kk5k32lgtrvj3mtb62ufm
- valory/wxdai:0.1.0:bafybeie3c5enerf54jt75xc62mbzck4kjqxpjx2mzo6v4rrz4dmcy4xdgy
- valory/fpmm:0.1.0:bafybeihoczslmqbfpx57tmjps663r2ib7ycc3dfa4smdhufb4wbnidewtq
protocols:
- open_aea/signing:1.0.0:bafybeifuxs7gdg2okbn7uofymenjlmnih2wxwkym44lsgwmklgwuckxm2m
- valory/abci:0.1.0:bafybeigootsvqpk6th5xpdtzanxum3earifrrezfyhylfrit7yvqdrtgpe
Expand All @@ -36,9 +37,9 @@ protocols:
skills:
- valory/abstract_abci:0.1.0:bafybeiamr3cwetayz6lr72buhq6iviabtboj4hhpq47tlumimxolvvqjcy
- valory/abstract_round_abci:0.1.0:bafybeiaseziuvbzh3trjggl5hx2tv3fduqrpiwiyksudaf6nvuxmwrg74i
- valory/market_maker_abci:0.1.0:bafybeibidkqzpqpx4cd2kil4f53ag32v4xyotxz5fn55iorgl7ylwdhcga
- valory/market_maker_abci:0.1.0:bafybeieu664wvp7pjnsvmg2dcuzej4tozseid74lvaflytwxtm57mu3kpu
- valory/registration_abci:0.1.0:bafybeibafy7qmcvvzaykimy3mbqdwtcuajmbghqilaa7zwkh6wla33cfce
- valory/market_creation_manager_abci:0.1.0:bafybeibaovti3jrf5syhtffkgnj34agk4decoiybeufh4yb6qpvvtqycve
- valory/market_creation_manager_abci:0.1.0:bafybeihavargx3sto43zh66zn7v5q7px7zgeebxq47gdfya66n2tqi6laa
- valory/market_validation_abci:0.1.0:bafybeifyfwynotmzg6wypbzbwsfnrplhjhumfx32dm2j3ddasp7ygrfoqa
- valory/reset_pause_abci:0.1.0:bafybeialcwck7fahrr23jckv5qjwg3cdq4ai2ihyjsofnbj44jzyl4cjmm
- valory/termination_abci:0.1.0:bafybeifqsogqiar4yook5bu3j6z66dbdcizey7dr3e5oxeocdjijvfbaja
Expand Down
40 changes: 39 additions & 1 deletion packages/valory/contracts/conditional_tokens/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@

"""This module contains the scaffold contract definition."""

from typing import Any
from typing import Any, List

from aea.common import JSONLike
from aea.configurations.base import PublicId
from aea.contracts.base import Contract
from aea.crypto.base import LedgerApi
from web3.types import BlockIdentifier


DEFAULT_OUTCOME_SLOT = 2
Expand Down Expand Up @@ -167,3 +168,40 @@ def get_condition_id(
tx_receipt
)
return "0x" + log["args"]["conditionId"].hex()

@classmethod
def get_condition_preparation_events(
cls,
ledger_api: LedgerApi,
contract_address: str,
condition_ids: List[bytes],
from_block: BlockIdentifier = "earliest",
to_block: BlockIdentifier = "latest",
) -> JSONLike:
"""Get condition preparation events."""
contract_instance = cls.get_instance(
ledger_api=ledger_api, contract_address=contract_address
)
entries = (
contract_instance.events.ConditionPreparation()
.createFilter(
fromBlock=from_block,
toBlock=to_block,
argument_filters={
"conditionId": condition_ids,
},
)
.get_all_entries()
)
events = list(
dict(
tx_hash=entry.transactionHash.hex(),
block_number=entry.blockNumber,
condition_id=entry["args"]["conditionId"],
oracle=entry["args"]["oracle"],
question_id=entry["args"]["questionId"],
outcome_slot_count=entry["args"]["outcomeSlotCount"],
)
for entry in entries
)
return dict(data=events)
7 changes: 5 additions & 2 deletions packages/valory/contracts/conditional_tokens/contract.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ aea_version: '>=1.0.0, <2.0.0'
fingerprint:
__init__.py: bafybeieeus2bbbexmthy4pnsdtgen4flxzk3ao5ekjbocvmrkhhszffbgu
build/ConditionalTokens.json: bafybeihhorqa54r2kxw6iavwdc427dqipltwehnjhxb3afjzox7moihesi
contract.py: bafybeiaubvleifulako3smzundvfcuw6qyu227kfa2j5asmqhbti5a3v7y
contract.py: bafybeihqah46zvullbgf5qpml3kwlngcrlj6lnj2vvnlrdpjizoxmuaepu
fingerprint_ignore_patterns: []
class_name: ConditionalTokensContract
contract_interface_paths:
ethereum: build/ConditionalTokens.json
dependencies: {}
dependencies:
hexbytes: {}
web3:
version: ==5.31.4
contracts: []
20 changes: 20 additions & 0 deletions packages/valory/contracts/fpmm/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2023 valory
#
# 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 scaffold contract."""
Loading

0 comments on commit 4c74d73

Please sign in to comment.