From d4dd9c4a0224d2a42cd28d0074e8bb8aeaf54cc1 Mon Sep 17 00:00:00 2001 From: Ardian Date: Thu, 4 Jan 2024 19:39:46 +0100 Subject: [PATCH 01/12] feat: add basic implementation of nevermined purchase --- .../transfer_nft_condition/README.md | 1 + .../transfer_nft_condition/__init__.py | 20 + .../build/TransferNFTCondition.json | 1027 +++++++++++++++++ .../transfer_nft_condition/contract.py | 67 ++ .../transfer_nft_condition/contract.yaml | 32 + .../behaviours/purchase_subscription.py | 233 ++++ .../skills/decision_maker_abci/models.py | 4 + .../skills/decision_maker_abci/payloads.py | 5 + .../skills/decision_maker_abci/states/base.py | 2 + .../states/purchase_subscription.py | 59 + 10 files changed, 1450 insertions(+) create mode 100644 packages/valory/contracts/transfer_nft_condition/README.md create mode 100644 packages/valory/contracts/transfer_nft_condition/__init__.py create mode 100644 packages/valory/contracts/transfer_nft_condition/build/TransferNFTCondition.json create mode 100644 packages/valory/contracts/transfer_nft_condition/contract.py create mode 100644 packages/valory/contracts/transfer_nft_condition/contract.yaml create mode 100644 packages/valory/skills/decision_maker_abci/behaviours/purchase_subscription.py create mode 100644 packages/valory/skills/decision_maker_abci/states/purchase_subscription.py diff --git a/packages/valory/contracts/transfer_nft_condition/README.md b/packages/valory/contracts/transfer_nft_condition/README.md new file mode 100644 index 000000000..e4d57e82f --- /dev/null +++ b/packages/valory/contracts/transfer_nft_condition/README.md @@ -0,0 +1 @@ +# TRANSFER_NFT_CONDITION token contract diff --git a/packages/valory/contracts/transfer_nft_condition/__init__.py b/packages/valory/contracts/transfer_nft_condition/__init__.py new file mode 100644 index 000000000..f3aad7986 --- /dev/null +++ b/packages/valory/contracts/transfer_nft_condition/__init__.py @@ -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 TransferNFTCondition.""" diff --git a/packages/valory/contracts/transfer_nft_condition/build/TransferNFTCondition.json b/packages/valory/contracts/transfer_nft_condition/build/TransferNFTCondition.json new file mode 100644 index 000000000..7351a321f --- /dev/null +++ b/packages/valory/contracts/transfer_nft_condition/build/TransferNFTCondition.json @@ -0,0 +1,1027 @@ +{ + "_format": "", + "contractName": "", + "sourceName": "", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "_agreementId", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "_did", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "_receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "_conditionId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "_contract", + "type": "address" + } + ], + "name": "Fulfilled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_id", + "type": "bytes32" + } + ], + "name": "abortByTimeOut", + "outputs": [ + { + "internalType": "enum ConditionStoreLibrary.ConditionState", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_addr", + "type": "address" + } + ], + "name": "addressToBytes32", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_b32", + "type": "bytes32" + } + ], + "name": "bytes32ToAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "_amounts", + "type": "uint256[]" + } + ], + "name": "calculateTotalAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_did", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_nftHolder", + "type": "address" + }, + { + "internalType": "address", + "name": "_nftReceiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_nftAmount", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "_lockPaymentCondition", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_nftContractAddress", + "type": "address" + }, + { + "internalType": "bool", + "name": "_transfer", + "type": "bool" + } + ], + "name": "encodeParams", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_agreementId", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_did", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_nftReceiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_nftAmount", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "_lockPaymentCondition", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_nftContractAddress", + "type": "address" + }, + { + "internalType": "bool", + "name": "_transfer", + "type": "bool" + } + ], + "name": "fulfill", + "outputs": [ + { + "internalType": "enum ConditionStoreLibrary.ConditionState", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_agreementId", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_did", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_nftReceiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_nftAmount", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "_lockPaymentCondition", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_nftContractAddress", + "type": "address" + }, + { + "internalType": "bool", + "name": "_transfer", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "_expirationBlock", + "type": "uint256" + } + ], + "name": "fulfill", + "outputs": [ + { + "internalType": "enum ConditionStoreLibrary.ConditionState", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_agreementId", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_did", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_nftReceiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_nftAmount", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "_lockPaymentCondition", + "type": "bytes32" + } + ], + "name": "fulfill", + "outputs": [ + { + "internalType": "enum ConditionStoreLibrary.ConditionState", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_agreementId", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_did", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_nftHolder", + "type": "address" + }, + { + "internalType": "address", + "name": "_nftReceiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_nftAmount", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "_lockPaymentCondition", + "type": "bytes32" + }, + { + "internalType": "bool", + "name": "_transfer", + "type": "bool" + } + ], + "name": "fulfillForDelegate", + "outputs": [ + { + "internalType": "enum ConditionStoreLibrary.ConditionState", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_agreementId", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_did", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_nftHolder", + "type": "address" + }, + { + "internalType": "address", + "name": "_nftReceiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_nftAmount", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "_lockPaymentCondition", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_nftContractAddress", + "type": "address" + }, + { + "internalType": "bool", + "name": "_transfer", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "_expirationBlock", + "type": "uint256" + } + ], + "name": "fulfillForDelegate", + "outputs": [ + { + "internalType": "enum ConditionStoreLibrary.ConditionState", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "_agreementId", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "_params", + "type": "bytes" + } + ], + "name": "fulfillProxy", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_agreementId", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_valueHash", + "type": "bytes32" + } + ], + "name": "generateId", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getCurrentBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getNFTDefaultAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getNvmConfigAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTrustedForwarder", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_nftContractAddress", + "type": "address" + } + ], + "name": "grantMarketRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_address", + "type": "address" + } + ], + "name": "grantProxyRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "hasNVMOperatorRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_did", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_nftHolder", + "type": "address" + }, + { + "internalType": "address", + "name": "_nftReceiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_nftAmount", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "_lockCondition", + "type": "bytes32" + } + ], + "name": "hashValues", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_did", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_nftHolder", + "type": "address" + }, + { + "internalType": "address", + "name": "_nftReceiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_nftAmount", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "_lockCondition", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_nftContractAddress", + "type": "address" + }, + { + "internalType": "bool", + "name": "_transfer", + "type": "bool" + } + ], + "name": "hashValues", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "address", + "name": "_conditionStoreManagerAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_didRegistryAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_ercAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_nftContractAddress", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "isContract", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "forwarder", + "type": "address" + } + ], + "name": "isTrustedForwarder", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_nftContractAddress", + "type": "address" + } + ], + "name": "revokeMarketRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_address", + "type": "address" + } + ], + "name": "revokeProxyRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "bytecode": "", + "deployedBytecode": "", + "linkReferences": {}, + "deployedLinkReferences": {} +} \ No newline at end of file diff --git a/packages/valory/contracts/transfer_nft_condition/contract.py b/packages/valory/contracts/transfer_nft_condition/contract.py new file mode 100644 index 000000000..2eef663ec --- /dev/null +++ b/packages/valory/contracts/transfer_nft_condition/contract.py @@ -0,0 +1,67 @@ +# -*- 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 class to connect to an TRANSFER_NFT_CONDITION token contract.""" + +from typing import Dict + +from aea.common import JSONLike +from aea.configurations.base import PublicId +from aea.contracts.base import Contract +from aea.crypto.base import LedgerApi +from aea_ledger_ethereum import EthereumApi +from web3 import Web3 + +PUBLIC_ID = PublicId.from_str("valory/transfer_nft_condition:0.1.0") + + +class TransferNftCondition(Contract): + """The TransferNftCondition contract.""" + + contract_id = PUBLIC_ID + + @classmethod + def build_fulfill_for_delegate_tx( + cls, + ledger_api: LedgerApi, + contract_address: str, + agreement_id: str, + did: str, + nft_holder: str, + nft_receiver: str, + nft_amount: int, + lock_payment_condition: str, + nft_contract_address: str, + transfer: bool, + expiration_block: int, + ) -> Dict[str, bytes]: + """Build an TransferNftCondition approval.""" + contract_instance = cls.get_instance(ledger_api, contract_address) + data = contract_instance.encodeABI("fulfillForDelegate", args=( + bytes.fromhex(agreement_id[2:]), + bytes.fromhex(did[2:]), + Web3.to_checksum_address(nft_holder), + Web3.to_checksum_address(nft_receiver), + nft_amount, + bytes.fromhex(lock_payment_condition[2:]), + Web3.to_checksum_address(nft_contract_address), + transfer, + expiration_block, + )) + return {"data": bytes.fromhex(data[2:])} diff --git a/packages/valory/contracts/transfer_nft_condition/contract.yaml b/packages/valory/contracts/transfer_nft_condition/contract.yaml new file mode 100644 index 000000000..d6b1143b3 --- /dev/null +++ b/packages/valory/contracts/transfer_nft_condition/contract.yaml @@ -0,0 +1,32 @@ +name: transfer_nft_condition +author: valory +version: 0.1.0 +type: contract +description: TRANSFER_NFT_CONDITION token contract +license: Apache-2.0 +aea_version: '>=1.0.0, <2.0.0' +fingerprint: + README.md: bafybeifmfma6rglvpa22odtozyosnp5mwljum64utxip2wgmezuhnjjjyi + __init__.py: bafybeia2k2vmq7lmd3uchmm6jmzj7ebqkogk5aolpw4nwsawnkgqfobltm + build/TransferNFTCondition.json: bafybeiemn5b5nszuss7xj6lmvmjuendltp6wz7ubihdvd7c6wqw4bohbpa + contract.py: bafybeif3vy43l7baa3doljavpfvy42mywkcgkvpvlilweluk5jf6e3doji +fingerprint_ignore_patterns: [] +contracts: [] +class_name: TransferNftCondition +contract_interface_paths: + ethereum: build/TransferNFTCondition.json +dependencies: + ecdsa: + version: '>=0.15' + eth_typing: {} + hexbytes: {} + open-aea-ledger-ethereum: + version: ==1.43.0.post2 + open-aea-test-autonomy: + version: ==0.13.9.post1 + packaging: {} + py-eth-sig-utils: {} + requests: + version: ==2.28.1 + web3: + version: <7,>=6.0.0 diff --git a/packages/valory/skills/decision_maker_abci/behaviours/purchase_subscription.py b/packages/valory/skills/decision_maker_abci/behaviours/purchase_subscription.py new file mode 100644 index 000000000..45ab407a5 --- /dev/null +++ b/packages/valory/skills/decision_maker_abci/behaviours/purchase_subscription.py @@ -0,0 +1,233 @@ +# -*- coding: utf-8 -*- +# ------------------------------------------------------------------------------ +# +# Copyright 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 behaviour for the decision-making of the skill.""" +import json +from typing import Any, Generator, Optional, Dict + +from hexbytes import HexBytes + +from packages.valory.contracts.erc20.contract import ERC20 +from packages.valory.contracts.transfer_nft_condition.contract import TransferNftCondition +from packages.valory.protocols.contract_api import ContractApiMessage +from packages.valory.skills.decision_maker_abci.behaviours.base import ( + DecisionMakerBaseBehaviour, +) +from packages.valory.skills.decision_maker_abci.models import MultisendBatch +from packages.valory.skills.decision_maker_abci.payloads import DecisionReceivePayload, SubscriptionPayload +from packages.valory.skills.decision_maker_abci.states.purchase_subscription import SubscriptionRound + + +class PurchaseSubscriptionBehaviour(DecisionMakerBaseBehaviour): + """A behaviour in which the agents purchase a subscriptions.""" + + matching_round = SubscriptionRound + + def __init__(self, **kwargs: Any) -> None: + """Initialize `RedeemBehaviour`.""" + super().__init__(**kwargs) + self.purchase_tx: str = "" + self.approval_tx: str = "" + + def _get_purchase_params(self) -> Generator[None, None, Optional[Dict[str, Any]]]: + """Get purchase params.""" + # this data was taken from the nervermined api, by analyzing the following subscription + # https://gnosis.nevermined.app/en/subscription/did:nv:416e35cb209ecbfbf23e1192557b06e94c5d9a9afb025cce2e9baff23e907195 + # more specifically the subscription creation tx: https://gnosisscan.io/tx/0x4cac38e6e28992ca8c20c92ffb8d0564dc7d1c3ca9f6b08db0a04b5f5fb23631 + # and the purchase tx: https://gnosisscan.io/tx/0x086e693fac1c3d084dffdc899adaca773ad986e6e2bff5700549e1ae8364731e (this is what the service should do) + + purchase_params = {} + + mech = self.params.mech_agent_address + params = self.params.mech_to_subscription_params[mech] + + base_url = params["base_url"] + did = params["did"] + purchase_params["did"] = did + purchase_params["nft_receiver"] = self.synchronized_data.safe_contract_address + purchase_params["contract_address"] = params["transfer_nft_condition_address"] + + did_url = f"{base_url}/{did}" + response = yield from self.get_http_response( + method="GET", + url=did_url, + headers={"accept": "application/json"}, + ) + if response.status_code != 200: + self.context.logger.error( + f"Could not retrieve data from did url {did_url}. " + f"Received status code {response.status_code}." + ) + return None + + try: + # TODO: would be good to get a sanity check here, whether its possible to get this information from somewhere else + data = json.loads(response.body)["data"] + service = data["service"] + for s in service: + if s["type"] == "nft_sales": + template = s["attributes"]["serviceAgreementTemplate"] + conditions = template["conditions"] + for condition in conditions: + if condition["type"] == "transferNFT": + transfer_params = condition["parameters"] + for param in transfer_params: + if param["name"] == "_nftHolder": + purchase_params["nft_holder"] = param["value"] + elif param["name"] == "_numberNfts": + purchase_params["nft_amount"] = int(param["value"]) + elif param["name"] == "_contractAddress": + purchase_params[ + "nft_contract_address" + ] = param["value"] + + except (ValueError, TypeError) as e: + self.context.logger.error( + f"Could not parse response from nervermined api, " + f"the following error was encountered {type(e).__name__}: {e}" + ) + return None + + # TODO + # purchase_params["agreement_id"] = "agreement_id" + # purchase_params["lock_payment_condition"] = "lock_payment_condition" + # purchase_params["transfer"] = "transfer", this might be always False from the txs I analyzed + # purchase_params["expiration_block"], this might be always 0 from the txs I analyzed + + return purchase_params + + def _get_approval_params(self) -> Dict[str, Any]: + """Get approval params.""" + approval_params = {} + mech = self.params.mech_agent_address + params = self.params.mech_to_subscription_params[mech] + approval_params["token"] = params["token"] + approval_params["spender"] = params["transfer_nft_condition_address"] + approval_params["amount"] = params["nft_price"] + return approval_params + + def _prepare_purchase_tx( + self, + contract_address: str, + agreement_id: str, + did: str, + nft_holder: str, + nft_receiver: str, + nft_amount: int, + lock_payment_condition: str, + nft_contract_address: str, + transfer: bool, + expiration_block: int, + ) -> Generator[None, None, bool]: + """Prepare a purchase tx.""" + result = yield from self.contract_interact( + performative=ContractApiMessage.Performative.GET_RAW_TRANSACTION, # type: ignore + contract_address=contract_address, + contract_public_id=TransferNftCondition.contract_id, + contract_callable="build_fulfill_for_delegate_tx", + data_key="data", + placeholder="approval_tx", + agreement_id=agreement_id, + did=did, + nft_holder=nft_holder, + nft_receiver=nft_receiver, + nft_amount=nft_amount, + lock_payment_condition=lock_payment_condition, + nft_contract_address=nft_contract_address, + transfer=transfer, + expiration_block=expiration_block, + ) + if not result: + return False + + self.multisend_batches.append( + MultisendBatch( + to=contract_address, + data=HexBytes(self.purchase_tx), + ) + ) + + def _prepare_approval_tx(self, token: str, spender: str, amount: int) -> Generator[None, None, bool]: + """Prepare an approval tx.""" + result = yield from self.contract_interact( + performative=ContractApiMessage.Performative.GET_RAW_TRANSACTION, # type: ignore + contract_address=token, + contract_public_id=ERC20.contract_id, + contract_callable="build_approval_tx", + data_key="data", + placeholder="approval_tx", + amount=amount, + spender=spender, + ) + if not result: + return False + + self.multisend_batches.append( + MultisendBatch( + to=token, + data=HexBytes(self.approval_tx), + ) + ) + + def _should_purchase(self) -> Generator[None, None, bool]: + """Check if the subscription should be purchased.""" + # TODO: check if the subscription should be purchased + # possible things to check: + # is the subscription already purchased? + # does the agent have enough funds? + # has the subscription run out? + + def get_payload_content(self) -> Generator[None, None, str]: + """Get the payload.""" + if not self._should_purchase(): + return SubscriptionRound.NO_TX_PAYLOAD + + approval_params = self._get_approval_params() + result = yield from self._prepare_approval_tx(**approval_params) + if not result: + return SubscriptionRound.ERROR_PAYLOAD + + purchase_params = yield from self._get_purchase_params() + if purchase_params is None: + return SubscriptionRound.ERROR_PAYLOAD + + result = yield from self._prepare_purchase_tx(**purchase_params) + if not result: + return SubscriptionRound.ERROR_PAYLOAD + + for build_step in ( + self._build_multisend_data, + self._build_multisend_safe_tx_hash, + ): + yield from self.wait_for_condition_with_sleep(build_step) + + return self.safe_tx_hash + + def async_act(self) -> Generator: + """Do the action.""" + + with self.context.benchmark_tool.measure(self.behaviour_id).local(): + payload_data = yield from self.get_payload_content() + sender = self.context.agent_address + payload = SubscriptionPayload( + sender, + tx_submitter=SubscriptionRound.auto_round_id(), + tx_hash=payload_data, + ) + yield from self.finish_behaviour(payload) diff --git a/packages/valory/skills/decision_maker_abci/models.py b/packages/valory/skills/decision_maker_abci/models.py index fa351eb3f..091cae9ec 100644 --- a/packages/valory/skills/decision_maker_abci/models.py +++ b/packages/valory/skills/decision_maker_abci/models.py @@ -320,6 +320,10 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: kwargs, bool, ) + self.mech_to_subscription_params: Dict[str, Dict[str, Any]] = nested_list_todict_workaround( + kwargs, + "mech_to_subscription_params", + ) super().__init__(*args, **kwargs) @property diff --git a/packages/valory/skills/decision_maker_abci/payloads.py b/packages/valory/skills/decision_maker_abci/payloads.py index 24a0d1dbe..82d453f29 100644 --- a/packages/valory/skills/decision_maker_abci/payloads.py +++ b/packages/valory/skills/decision_maker_abci/payloads.py @@ -68,6 +68,11 @@ class RequestPayload(MultisigTxPayload): price: Optional[int] = None +@dataclass(frozen=True) +class SubscriptionPayload(MultisigTxPayload): + """Represents a transaction payload for subscribing.""" + + @dataclass(frozen=True) class VotingPayload(BaseTxPayload): """Represents a transaction payload for voting.""" diff --git a/packages/valory/skills/decision_maker_abci/states/base.py b/packages/valory/skills/decision_maker_abci/states/base.py index a75be3b0d..c4ed29bd1 100644 --- a/packages/valory/skills/decision_maker_abci/states/base.py +++ b/packages/valory/skills/decision_maker_abci/states/base.py @@ -52,6 +52,8 @@ class Event(Enum): NO_REDEEMING = "no_redeeming" BLACKLIST = "blacklist" NO_OP = "no_op" + SUBSCRIPTION_ERROR = "subscription_error" + NO_SUBSCRIPTION = "no_subscription" ROUND_TIMEOUT = "round_timeout" REDEEM_ROUND_TIMEOUT = "redeem_round_timeout" NO_MAJORITY = "no_majority" diff --git a/packages/valory/skills/decision_maker_abci/states/purchase_subscription.py b/packages/valory/skills/decision_maker_abci/states/purchase_subscription.py new file mode 100644 index 000000000..48b8240e3 --- /dev/null +++ b/packages/valory/skills/decision_maker_abci/states/purchase_subscription.py @@ -0,0 +1,59 @@ +# -*- 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 decision receiving state of the decision-making abci app.""" + +from enum import Enum +from typing import Optional, Tuple, cast, Type + +from packages.valory.skills.abstract_round_abci.base import ( + CollectSameUntilThresholdRound, + get_name, BaseSynchronizedData, +) +from packages.valory.skills.decision_maker_abci.payloads import DecisionReceivePayload, MultisigTxPayload, \ + SubscriptionPayload +from packages.valory.skills.decision_maker_abci.states.base import ( + Event, + SynchronizedData, TxPreparationRound, +) + + +class SubscriptionRound(TxPreparationRound): + """A round in which the agents prepare a tx to initiate a request to a mech to determine the answer to a bet.""" + + payload_class: Type[MultisigTxPayload] = SubscriptionPayload + selection_key = TxPreparationRound.selection_key + ( + get_name(SynchronizedData.mech_price), + ) + none_event = Event.NO_SUBSCRIPTION + + NO_TX_PAYLOAD = "no_tx" + ERROR_PAYLOAD = "error" + + def end_block(self) -> Optional[Tuple[BaseSynchronizedData, Enum]]: + """Process the end of the block.""" + if self.threshold_reached: + payload = cast(SubscriptionPayload, self.most_voted_payload) + if payload.tx_hash == self.ERROR_PAYLOAD: + return self.synchronized_data, Event.SUBSCRIPTION_ERROR + + if payload.tx_hash == self.NO_TX_PAYLOAD: + return self.synchronized_data, Event.NO_SUBSCRIPTION + + return super().end_block() From a5943a6bcc3ad40b02879e92acf28d2a3563b288 Mon Sep 17 00:00:00 2001 From: Ardian Date: Wed, 17 Jan 2024 00:03:58 +0100 Subject: [PATCH 02/12] feat: add nevermined-sdk utils --- .../behaviours/purchase_subscription.py | 73 +++++------ .../decision_maker_abci/utils/__init__.py | 20 +++ .../decision_maker_abci/utils/nevermined.py | 121 ++++++++++++++++++ 3 files changed, 170 insertions(+), 44 deletions(-) create mode 100644 packages/valory/skills/decision_maker_abci/utils/__init__.py create mode 100644 packages/valory/skills/decision_maker_abci/utils/nevermined.py diff --git a/packages/valory/skills/decision_maker_abci/behaviours/purchase_subscription.py b/packages/valory/skills/decision_maker_abci/behaviours/purchase_subscription.py index 45ab407a5..7c34d0469 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/purchase_subscription.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/purchase_subscription.py @@ -32,6 +32,7 @@ from packages.valory.skills.decision_maker_abci.models import MultisendBatch from packages.valory.skills.decision_maker_abci.payloads import DecisionReceivePayload, SubscriptionPayload from packages.valory.skills.decision_maker_abci.states.purchase_subscription import SubscriptionRound +from packages.valory.skills.decision_maker_abci.utils.nevermined import generate_id, zero_x_transformer, no_did_prefixed class PurchaseSubscriptionBehaviour(DecisionMakerBaseBehaviour): @@ -45,25 +46,27 @@ def __init__(self, **kwargs: Any) -> None: self.purchase_tx: str = "" self.approval_tx: str = "" - def _get_purchase_params(self) -> Generator[None, None, Optional[Dict[str, Any]]]: - """Get purchase params.""" - # this data was taken from the nervermined api, by analyzing the following subscription - # https://gnosis.nevermined.app/en/subscription/did:nv:416e35cb209ecbfbf23e1192557b06e94c5d9a9afb025cce2e9baff23e907195 - # more specifically the subscription creation tx: https://gnosisscan.io/tx/0x4cac38e6e28992ca8c20c92ffb8d0564dc7d1c3ca9f6b08db0a04b5f5fb23631 - # and the purchase tx: https://gnosisscan.io/tx/0x086e693fac1c3d084dffdc899adaca773ad986e6e2bff5700549e1ae8364731e (this is what the service should do) - - purchase_params = {} - + @property + def subscription_params(self) -> Dict[str, Any]: + """Get the subscription params.""" mech = self.params.mech_agent_address - params = self.params.mech_to_subscription_params[mech] - - base_url = params["base_url"] - did = params["did"] - purchase_params["did"] = did - purchase_params["nft_receiver"] = self.synchronized_data.safe_contract_address - purchase_params["contract_address"] = params["transfer_nft_condition_address"] - - did_url = f"{base_url}/{did}" + return self.params.mech_to_subscription_params[mech] + + @property + def did(self) -> str: + """Get the did.""" + subscription_params = self.subscription_params + return subscription_params["did"] + + @property + def base_url(self) -> str: + """Get the base url.""" + subscription_params = self.subscription_params + return subscription_params["base_url"] + + def _resolve_did(self) -> Generator[None, None, Optional[Dict[str, Any]]]: + """Resolve and parse the did.""" + did_url = f"{self.base_url}/{self.did}" response = yield from self.get_http_response( method="GET", url=did_url, @@ -75,28 +78,8 @@ def _get_purchase_params(self) -> Generator[None, None, Optional[Dict[str, Any]] f"Received status code {response.status_code}." ) return None - try: - # TODO: would be good to get a sanity check here, whether its possible to get this information from somewhere else data = json.loads(response.body)["data"] - service = data["service"] - for s in service: - if s["type"] == "nft_sales": - template = s["attributes"]["serviceAgreementTemplate"] - conditions = template["conditions"] - for condition in conditions: - if condition["type"] == "transferNFT": - transfer_params = condition["parameters"] - for param in transfer_params: - if param["name"] == "_nftHolder": - purchase_params["nft_holder"] = param["value"] - elif param["name"] == "_numberNfts": - purchase_params["nft_amount"] = int(param["value"]) - elif param["name"] == "_contractAddress": - purchase_params[ - "nft_contract_address" - ] = param["value"] - except (ValueError, TypeError) as e: self.context.logger.error( f"Could not parse response from nervermined api, " @@ -104,16 +87,18 @@ def _get_purchase_params(self) -> Generator[None, None, Optional[Dict[str, Any]] ) return None - # TODO - # purchase_params["agreement_id"] = "agreement_id" - # purchase_params["lock_payment_condition"] = "lock_payment_condition" - # purchase_params["transfer"] = "transfer", this might be always False from the txs I analyzed - # purchase_params["expiration_block"], this might be always 0 from the txs I analyzed + return data + + def _get_purchase_params(self) -> Generator[None, None, Optional[Dict[str, Any]]]: + """Get purchase params.""" + agreement_id = zero_x_transformer(generate_id()) + did = zero_x_transformer(no_did_prefixed(self.did)) + - return purchase_params def _get_approval_params(self) -> Dict[str, Any]: """Get approval params.""" + # TODO: get these from the did doc approval_params = {} mech = self.params.mech_agent_address params = self.params.mech_to_subscription_params[mech] diff --git a/packages/valory/skills/decision_maker_abci/utils/__init__.py b/packages/valory/skills/decision_maker_abci/utils/__init__.py new file mode 100644 index 000000000..316da2085 --- /dev/null +++ b/packages/valory/skills/decision_maker_abci/utils/__init__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# ------------------------------------------------------------------------------ +# +# Copyright 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 package contains helpers.""" + diff --git a/packages/valory/skills/decision_maker_abci/utils/nevermined.py b/packages/valory/skills/decision_maker_abci/utils/nevermined.py new file mode 100644 index 000000000..d187e819b --- /dev/null +++ b/packages/valory/skills/decision_maker_abci/utils/nevermined.py @@ -0,0 +1,121 @@ +# -*- coding: utf-8 -*- +# ------------------------------------------------------------------------------ +# +# Copyright 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 behaviour for the decision-making of the skill.""" + +import re +import uuid +from typing import Dict, Any + +import requests + + +def zero_x_transformer(input_str: str, zero_output: bool = True) -> str: + """Transform a string to a hex string.""" + match = re.match(r'^(?:0x)*([a-f0-9]+)$', input_str, re.IGNORECASE) + valid = match is not None + output = match.group(1) if valid else '' + + return ('0x' if zero_output and valid else '') + output + + +def generate_id(length: int = 64) -> str: + """Generate a random ID.""" + generated_id = '' + while len(generated_id) < length: + generated_id += str(uuid.uuid4()).replace('-', '') + + return generated_id[:length] + + +def find_service_by_type(did_doc: Dict[str, Any], type: str) -> Dict[str, Any]: + """Find a service by name.""" + services = did_doc.get('service', []) + for service in services: + if service.get('type') == type: + return service + + raise Exception(f'No service found with type {type}') + + +def find_service_condition_by_name(service: Dict[str, Any], name: str): + conditions = service.get('attributes', {}).get('serviceAgreementTemplate', {}).get('conditions', []) + + condition = next((c for c in conditions if c['name'] == name), None) + + if condition is None: + raise Exception(f"Condition '{name}' not found.") + + return condition + +def get_asset_price_from_service(service: Dict[str, Any]) -> Dict[str, int]: + """Get the price of a DID.""" + escrow_payment_condition = find_service_condition_by_name(service, 'escrowPayment') + + if not escrow_payment_condition: + raise Exception('escrowPayment not found in service') + + amounts = next((p['value'] for p in escrow_payment_condition.get('parameters', []) if p['name'] == '_amounts'), []) + receivers = next((p['value'] for p in escrow_payment_condition.get('parameters', []) if p['name'] == '_receivers'), []) + + rewards_map = dict(zip(receivers, map(int, amounts))) + + return rewards_map + +def get_price(did_doc: Dict[str, Any], type: str = 'nft-sales') -> Dict[str, int]: + """Get the price of a DID.""" + service = find_service_by_type(did_doc, type) + return get_asset_price_from_service(service) + + +def get_nft_address(did_doc: Dict[str, Any], type: str = 'nft-sales') -> str: + """Get the NFT address of a DID.""" + service = find_service_by_type(did_doc, type) + transfer_condition = find_service_condition_by_name(service, 'transferNFT') + contract_param = next((p['value'] for p in transfer_condition.get('parameters', []) if p['name'] == '_contractAddress' or p['name'] == '_contract'), None) + + return contract_param if contract_param is not None else '' + + +def no_did_prefixed(input_string: str) -> str: + """Remove the DID prefix from a string.""" + return did_transformer(input_string, False) + + +def did_transformer(input_string: str, prefix_output: bool = False) -> str: + """Transform a string to a DID.""" + pattern = re.compile(r'^(?:0x|did:nv:)*([a-f0-9]{64})$', re.IGNORECASE) + match_result = input_match(input_string, pattern, 'did_transformer') + + valid, output = match_result['valid'], match_result['output'] + + return ('did:nv:' if prefix_output and valid else '') + output + + +def input_match(input_string, pattern, function_name): + match_result = re.match(pattern, input_string) + if match_result: + return {'valid': True, 'output': match_result.group(1)} + else: + return {'valid': False, 'output': ''} + +# TODO: remove +res = requests.get('https://marketplace-api.gnosis.nevermined.app/api/v1/metadata/assets/ddo/did:nv:416e35cb209ecbfbf23e1192557b06e94c5d9a9afb025cce2e9baff23e907195') +did_doc = res.json() +print(get_nft_address(did_doc)) \ No newline at end of file From c3c3d423d6d0b7f68a705db01d8fc88fe6367b30 Mon Sep 17 00:00:00 2001 From: Ardian Date: Wed, 17 Jan 2024 21:40:32 +0100 Subject: [PATCH 03/12] feat: add order flow [no ci] --- .../build/TransferNFTCondition.json | 55 ++++++ .../transfer_nft_condition/contract.py | 38 ++-- ..._subscription.py => order_subscription.py} | 182 +++++++++++++++--- ..._subscription.py => order_subscription.py} | 0 .../decision_maker_abci/utils/nevermined.py | 163 +++++++++++++++- 5 files changed, 384 insertions(+), 54 deletions(-) rename packages/valory/skills/decision_maker_abci/behaviours/{purchase_subscription.py => order_subscription.py} (55%) rename packages/valory/skills/decision_maker_abci/states/{purchase_subscription.py => order_subscription.py} (100%) diff --git a/packages/valory/contracts/transfer_nft_condition/build/TransferNFTCondition.json b/packages/valory/contracts/transfer_nft_condition/build/TransferNFTCondition.json index 7351a321f..c10d67b1b 100644 --- a/packages/valory/contracts/transfer_nft_condition/build/TransferNFTCondition.json +++ b/packages/valory/contracts/transfer_nft_condition/build/TransferNFTCondition.json @@ -1018,6 +1018,61 @@ "outputs": [], "stateMutability": "nonpayable", "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "did", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "nftHolder", + "type": "address" + }, + { + "internalType": "address", + "name": "nftReceiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nftAmount", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "lockCondition", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "nftContractAddress", + "type": "address" + }, + { + "internalType": "bool", + "name": "transfer", + "type": "bool" + } + ], + "internalType": "struct EscrowComputeExecutionCondition.FulfillArgs", + "name": "_fulfillArgs", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "_signature", + "type": "bytes" + } + ], + "name": "createAgreementAndPayEscrow" + "outputs": [], + "stateMutability": "payable", + "type": "function" } ], "bytecode": "", diff --git a/packages/valory/contracts/transfer_nft_condition/contract.py b/packages/valory/contracts/transfer_nft_condition/contract.py index 2eef663ec..413fd3f75 100644 --- a/packages/valory/contracts/transfer_nft_condition/contract.py +++ b/packages/valory/contracts/transfer_nft_condition/contract.py @@ -19,7 +19,7 @@ """This module contains the class to connect to an TRANSFER_NFT_CONDITION token contract.""" -from typing import Dict +from typing import Dict, List from aea.common import JSONLike from aea.configurations.base import PublicId @@ -37,31 +37,35 @@ class TransferNftCondition(Contract): contract_id = PUBLIC_ID @classmethod - def build_fulfill_for_delegate_tx( + def build_order_tx( cls, ledger_api: LedgerApi, contract_address: str, agreement_id: str, did: str, - nft_holder: str, - nft_receiver: str, - nft_amount: int, - lock_payment_condition: str, - nft_contract_address: str, - transfer: bool, - expiration_block: int, + condition_ids: List[str], + time_locks: List[int], + time_outs: List[int], + consumer: str, + index: int, + reward_address: str, + token_address: str, + amounts: List[int], + receives: List[str], ) -> Dict[str, bytes]: """Build an TransferNftCondition approval.""" contract_instance = cls.get_instance(ledger_api, contract_address) - data = contract_instance.encodeABI("fulfillForDelegate", args=( + data = contract_instance.encodeABI("createAgreementAndPayEscrow", args=( bytes.fromhex(agreement_id[2:]), bytes.fromhex(did[2:]), - Web3.to_checksum_address(nft_holder), - Web3.to_checksum_address(nft_receiver), - nft_amount, - bytes.fromhex(lock_payment_condition[2:]), - Web3.to_checksum_address(nft_contract_address), - transfer, - expiration_block, + [bytes.fromhex(condition_id[2:]) for condition_id in condition_ids], + time_locks, + time_outs, + Web3.to_checksum_address(consumer), + index, + Web3.to_checksum_address(reward_address), + Web3.to_checksum_address(token_address), + amounts, + [Web3.to_checksum_address(receive) for receive in receives], )) return {"data": bytes.fromhex(data[2:])} diff --git a/packages/valory/skills/decision_maker_abci/behaviours/purchase_subscription.py b/packages/valory/skills/decision_maker_abci/behaviours/order_subscription.py similarity index 55% rename from packages/valory/skills/decision_maker_abci/behaviours/purchase_subscription.py rename to packages/valory/skills/decision_maker_abci/behaviours/order_subscription.py index 7c34d0469..69f91ba41 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/purchase_subscription.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/order_subscription.py @@ -19,7 +19,7 @@ """This module contains the behaviour for the decision-making of the skill.""" import json -from typing import Any, Generator, Optional, Dict +from typing import Any, Generator, Optional, Dict, List from hexbytes import HexBytes @@ -32,7 +32,13 @@ from packages.valory.skills.decision_maker_abci.models import MultisendBatch from packages.valory.skills.decision_maker_abci.payloads import DecisionReceivePayload, SubscriptionPayload from packages.valory.skills.decision_maker_abci.states.purchase_subscription import SubscriptionRound -from packages.valory.skills.decision_maker_abci.utils.nevermined import generate_id, zero_x_transformer, no_did_prefixed +from packages.valory.skills.decision_maker_abci.utils.nevermined import generate_id, zero_x_transformer, \ + no_did_prefixed, get_lock_payment_seed, get_price, get_transfer_nft_condition_seed, get_escrow_payment_seed, \ + get_timeouts_and_timelocks, get_reward_address + + +LOCK_CONDITION_INDEX = 1 + class PurchaseSubscriptionBehaviour(DecisionMakerBaseBehaviour): @@ -43,8 +49,9 @@ class PurchaseSubscriptionBehaviour(DecisionMakerBaseBehaviour): def __init__(self, **kwargs: Any) -> None: """Initialize `RedeemBehaviour`.""" super().__init__(**kwargs) - self.purchase_tx: str = "" + self.order_tx: str = "" self.approval_tx: str = "" + self.balance: int = 0 @property def subscription_params(self) -> Dict[str, Any]: @@ -58,6 +65,42 @@ def did(self) -> str: subscription_params = self.subscription_params return subscription_params["did"] + @property + def escrow_payment_condition_address(self) -> str: + """Get the escrow payment address.""" + subscription_params = self.subscription_params + return subscription_params["escrow_payment_condition_address"] + + @property + def lock_payment_condition_address(self) -> str: + """Get the lock payment address.""" + subscription_params = self.subscription_params + return subscription_params["lock_payment_condition_address"] + + @property + def transfer_nft_condition_address(self) -> str: + """Get the transfer nft condition address.""" + subscription_params = self.subscription_params + return subscription_params["transfer_nft_condition_address"] + + @property + def token_address(self) -> str: + """Get the token address.""" + subscription_params = self.subscription_params + return subscription_params["token"] + + @property + def purchase_amount(self) -> int: + """Get the purchase amount.""" + subscription_params = self.subscription_params + return subscription_params["nft_amount"] + + @property + def price(self) -> int: + """Get the price.""" + subscription_params = self.subscription_params + return subscription_params["price"] + @property def base_url(self) -> str: """Get the base url.""" @@ -89,54 +132,114 @@ def _resolve_did(self) -> Generator[None, None, Optional[Dict[str, Any]]]: return data + def _get_condition_ids(self, did_doc: Dict[str, Any]) -> List[str]: + """Get the condition ids.""" + price = get_price(did_doc) + receivers = list(price.keys()) + amounts = list(price.values()) + lock_payment_seed = get_lock_payment_seed( + did_doc, + self.escrow_payment_condition_address, + self.token_address, + amounts, + receivers, + ) + transfer_nft_condition_seed = get_transfer_nft_condition_seed( + did_doc, + self.transfer_nft_condition_address, + self.purchase_amount, + lock_payment_seed, + self.token_address, + ) + escrow_payment_seed = get_escrow_payment_seed( + did_doc, + amounts, + receivers, + self.synchronized_data.safe_contract_address, + self.escrow_payment_condition_address, + self.token_address, + lock_payment_seed, + transfer_nft_condition_seed, + ) + condition_ids = [ + lock_payment_seed, + transfer_nft_condition_seed, + escrow_payment_seed, + ] + return condition_ids + + def _get_purchase_params(self) -> Generator[None, None, Optional[Dict[str, Any]]]: """Get purchase params.""" agreement_id = zero_x_transformer(generate_id()) did = zero_x_transformer(no_did_prefixed(self.did)) + did_doc = yield from self._resolve_did() + if did_doc is None: + # something went wrong + return None + condition_ids = self._get_condition_ids(did_doc) + timeouts, timelocks = get_timeouts_and_timelocks(did_doc) + reward_address = get_reward_address(did_doc) + price = get_price(did_doc) + receivers = list(price.keys()) + amounts = list(price.values()) - + return { + "agreement_id": agreement_id, + "did": did, + "condition_ids": condition_ids, + "consumer": self.synchronized_data.safe_contract_address, + "index": LOCK_CONDITION_INDEX, + "timeouts": timeouts, + "timelocks": timelocks, + "reward_address": reward_address, + "receivers": receivers, + "amounts": amounts, + } def _get_approval_params(self) -> Dict[str, Any]: """Get approval params.""" # TODO: get these from the did doc approval_params = {} - mech = self.params.mech_agent_address - params = self.params.mech_to_subscription_params[mech] - approval_params["token"] = params["token"] - approval_params["spender"] = params["transfer_nft_condition_address"] - approval_params["amount"] = params["nft_price"] + approval_params["token"] = self.token_address + approval_params["spender"] = self.transfer_nft_condition_address + approval_params["amount"] = self.price return approval_params - def _prepare_purchase_tx( + def _prepare_order_tx( self, contract_address: str, agreement_id: str, did: str, - nft_holder: str, - nft_receiver: str, - nft_amount: int, - lock_payment_condition: str, - nft_contract_address: str, - transfer: bool, - expiration_block: int, + condition_ids: List[str], + time_locks: List[int], + time_outs: List[int], + consumer: str, + index: int, + reward_address: str, + token_address: str, + amounts: List[int], + receives: List[str], ) -> Generator[None, None, bool]: """Prepare a purchase tx.""" result = yield from self.contract_interact( performative=ContractApiMessage.Performative.GET_RAW_TRANSACTION, # type: ignore contract_address=contract_address, contract_public_id=TransferNftCondition.contract_id, - contract_callable="build_fulfill_for_delegate_tx", + contract_callable="build_order_tx", data_key="data", - placeholder="approval_tx", + placeholder="order_tx", agreement_id=agreement_id, did=did, - nft_holder=nft_holder, - nft_receiver=nft_receiver, - nft_amount=nft_amount, - lock_payment_condition=lock_payment_condition, - nft_contract_address=nft_contract_address, - transfer=transfer, - expiration_block=expiration_block, + condition_ids=condition_ids, + time_locks=time_locks, + time_outs=time_outs, + consumer=consumer, + index=index, + reward_address=reward_address, + token_address=token_address, + amounts=amounts, + receives=receives, ) if not result: return False @@ -169,14 +272,29 @@ def _prepare_approval_tx(self, token: str, spender: str, amount: int) -> Generat data=HexBytes(self.approval_tx), ) ) + def _get_balance(self, token: str, address: str) -> Generator[None, None, bool]: + """Prepare an approval tx.""" + result = yield from self.contract_interact( + performative=ContractApiMessage.Performative.GET_RAW_TRANSACTION, # type: ignore + contract_address=token, + contract_public_id=ERC20.contract_id, + contract_callable="check_balance", + data_key="token", + placeholder="balance", + account=address, + ) + if not result: + return False + def _should_purchase(self) -> Generator[None, None, bool]: """Check if the subscription should be purchased.""" - # TODO: check if the subscription should be purchased - # possible things to check: - # is the subscription already purchased? - # does the agent have enough funds? - # has the subscription run out? + result = yield from self._get_balance(self.token_address, self.synchronized_data.safe_contract_address) + if not result: + self.context.logger.warning("Failed to get balance") + return False + + return self.balance <= 0 def get_payload_content(self) -> Generator[None, None, str]: """Get the payload.""" @@ -192,7 +310,7 @@ def get_payload_content(self) -> Generator[None, None, str]: if purchase_params is None: return SubscriptionRound.ERROR_PAYLOAD - result = yield from self._prepare_purchase_tx(**purchase_params) + result = yield from self._prepare_order_tx(**purchase_params) if not result: return SubscriptionRound.ERROR_PAYLOAD diff --git a/packages/valory/skills/decision_maker_abci/states/purchase_subscription.py b/packages/valory/skills/decision_maker_abci/states/order_subscription.py similarity index 100% rename from packages/valory/skills/decision_maker_abci/states/purchase_subscription.py rename to packages/valory/skills/decision_maker_abci/states/order_subscription.py diff --git a/packages/valory/skills/decision_maker_abci/utils/nevermined.py b/packages/valory/skills/decision_maker_abci/utils/nevermined.py index d187e819b..c2713532f 100644 --- a/packages/valory/skills/decision_maker_abci/utils/nevermined.py +++ b/packages/valory/skills/decision_maker_abci/utils/nevermined.py @@ -21,9 +21,10 @@ import re import uuid -from typing import Dict, Any +from typing import Dict, Any, List, Tuple import requests +from web3 import Web3 def zero_x_transformer(input_str: str, zero_output: bool = True) -> str: @@ -54,7 +55,8 @@ def find_service_by_type(did_doc: Dict[str, Any], type: str) -> Dict[str, Any]: raise Exception(f'No service found with type {type}') -def find_service_condition_by_name(service: Dict[str, Any], name: str): +def find_service_condition_by_name(service: Dict[str, Any], name: str) -> Dict[str, Any]: + """Find a condition by name.""" conditions = service.get('attributes', {}).get('serviceAgreementTemplate', {}).get('conditions', []) condition = next((c for c in conditions if c['name'] == name), None) @@ -92,6 +94,22 @@ def get_nft_address(did_doc: Dict[str, Any], type: str = 'nft-sales') -> str: return contract_param if contract_param is not None else '' +def get_nft_holder(did_doc: Dict[str, Any], type: str = 'nft-sales') -> str: + """Get the NFT holder of a DID.""" + service = find_service_by_type(did_doc, type) + transfer_condition = find_service_condition_by_name(service, 'transferNFT') + contract_param = next((p['value'] for p in transfer_condition.get('parameters', []) if p['name'] == '_nftHolder'), None) + + return contract_param if contract_param is not None else '' + +def get_nft_transfer(did_doc: Dict[str, Any], type: str = 'nft-sales') -> str: + """Get the NFT holder of a DID.""" + service = find_service_by_type(did_doc, type) + transfer_condition = find_service_condition_by_name(service, 'transferNFT') + contract_param = next((p['value'] for p in transfer_condition.get('parameters', []) if p['name'] == '_nftTransfer'), None) + + return contract_param if contract_param is not None else '' + def no_did_prefixed(input_string: str) -> str: """Remove the DID prefix from a string.""" @@ -101,21 +119,156 @@ def no_did_prefixed(input_string: str) -> str: def did_transformer(input_string: str, prefix_output: bool = False) -> str: """Transform a string to a DID.""" pattern = re.compile(r'^(?:0x|did:nv:)*([a-f0-9]{64})$', re.IGNORECASE) - match_result = input_match(input_string, pattern, 'did_transformer') + match_result = input_match(input_string, pattern) valid, output = match_result['valid'], match_result['output'] return ('did:nv:' if prefix_output and valid else '') + output -def input_match(input_string, pattern, function_name): +def input_match(input_string: str, pattern: re.Pattern[str]) -> Dict[str, Any]: match_result = re.match(pattern, input_string) if match_result: return {'valid': True, 'output': match_result.group(1)} else: return {'valid': False, 'output': ''} + +def hash_data( + types: List[str], + values: List[Any], +) -> str: + """Hash data.""" + encoded_data = Web3.solidity_keccak(types, values) + return encoded_data.hex() + + +def short_id(did: str) -> str: + """Get the short ID of a DID.""" + return did.replace('did:nv:', '') + + +def get_agreement_id(seed: str, creator: str) -> str: + """Get the agreement ID.""" + seed_0x = zero_x_transformer(seed) + creator_0x = Web3.to_checksum_address(creator) + return hash_data(['bytes32', 'address'], [seed_0x, creator_0x]) + + +def get_lock_payment_seed( + did_doc: Dict[str, Any], + escrow_payment_condition_address: str, + token_address: str, + amounts: List[int], + receivers: List[str], +) -> str: + """Get the lock payment seed.""" + short_id_ = zero_x_transformer(short_id(did_doc['id'])) + escrow_payment_condition_address_0x = zero_x_transformer(escrow_payment_condition_address) + token_address = Web3.to_checksum_address(token_address) + receivers = [Web3.to_checksum_address(receiver) for receiver in receivers] + + return hash_data( + ['bytes32', 'bytes32', 'address', 'uint256[]', 'address[]'], + [short_id_, escrow_payment_condition_address_0x, token_address, amounts, receivers], + ) + +def get_transfer_nft_condition_seed( + did_doc: Dict[str, Any], + buyer_address: str, + nft_amount: int, + lock_condition_id: str, + nft_contract_address: str, + expiration: int = 0, +) -> str: + """Get the lock payment seed.""" + short_id_ = zero_x_transformer(short_id(did_doc['id'])) + nft_holder = Web3.to_checksum_address(get_nft_holder(did_doc)) + will_transfer = get_nft_transfer(did_doc) == 'true' + + return hash_data( + ['bytes32', 'address', 'address', 'uint256', 'bytes32', 'address', 'bool'], + [ + short_id_, + nft_holder, + Web3.to_checksum_address(buyer_address), + nft_amount, + lock_condition_id, + Web3.to_checksum_address(nft_contract_address), + will_transfer, + ], + ) + +def get_escrow_payment_seed( + did_doc: Dict[str, Any], + amounts: List[int], + receivers: List[str], + buyer_address: str, + escrow_payment_condition_address: str, + token_address: str, + lock_seed: str, + access_seed: str, +) -> str: + """Get the escrow payment seed.""" + short_id_ = zero_x_transformer(short_id(did_doc['id'])) + escrow_payment_condition_address = Web3.to_checksum_address(escrow_payment_condition_address) + receivers = [Web3.to_checksum_address(receiver) for receiver in receivers] + buyer_address = Web3.to_checksum_address(buyer_address) + token_address = Web3.to_checksum_address(token_address) + + return hash_data( + ['bytes32', 'uint256[]', 'address[]', 'address', 'address', 'address', 'bytes32', 'bytes32'], + [short_id_, amounts, receivers, buyer_address, escrow_payment_condition_address, token_address, lock_seed, access_seed] + ) + + +def get_timeouts_and_timelocks(did_doc: Dict[str, Any]) -> Tuple[List[int], List[int]]: + """Get timeouts and timelocks""" + type = 'nft-sales' + service = find_service_by_type(did_doc, type) + conditions = service.get('attributes', {}).get('serviceAgreementTemplate', {}).get('conditions', []) + timeouts, timelocks = [], [] + for condition in conditions: + timeouts.append(condition.get('timeout', 0)) + timelocks.append(condition.get('timelock', 0)) + + return timeouts, timelocks + + +def get_reward_address(did_doc: Dict[str, Any], type: str = 'nft-sales') -> str: + """Get the reward address of a DID.""" + service = find_service_by_type(did_doc, type) + transfer_condition = find_service_condition_by_name(service, 'lockPayment') + contract_param = next((p['value'] for p in transfer_condition.get('parameters', []) if p['name'] == '_rewardAddress'), None) + + return contract_param if contract_param is not None else '' + + # TODO: remove res = requests.get('https://marketplace-api.gnosis.nevermined.app/api/v1/metadata/assets/ddo/did:nv:416e35cb209ecbfbf23e1192557b06e94c5d9a9afb025cce2e9baff23e907195') did_doc = res.json() -print(get_nft_address(did_doc)) \ No newline at end of file +price = get_price(did_doc) +print(get_reward_address(did_doc)) +seed = get_lock_payment_seed( + did_doc, + '0x5e1d1eb61e1164d5a50b28c575da73a29595dff7', + '0x5e1d1eb61e1164d5a50b28c575da73a29595dff7', + list(price.values()), + list(price.keys()), +) +seed_access = get_transfer_nft_condition_seed( + did_doc, + '0x5e1d1eb61e1164d5a50b28c575da73a29595dff7', + 1, + seed, + '0x5e1d1eb61e1164d5a50b28c575da73a29595dff7', + ) +print( +get_escrow_payment_seed(did_doc, + list(price.values()), + list(price.keys()), + '0x5e1d1eb61e1164d5a50b28c575da73a29595dff7', + '0x5e1d1eb61e1164d5a50b28c575da73a29595dff7', + '0x5e1d1eb61e1164d5a50b28c575da73a29595dff7', + seed, + seed_access, )) \ No newline at end of file From 5d7ce24b01988b9864d85956b7ec4b27d8918c22 Mon Sep 17 00:00:00 2001 From: Ardian Date: Thu, 18 Jan 2024 12:10:59 +0100 Subject: [PATCH 04/12] feat: add claim flow [no ci] --- packages/valory/agents/trader/aea-config.yaml | 32 +++---- .../transfer_nft_condition/contract.yaml | 8 +- .../decision_maker_abci/behaviours/base.py | 82 +++++++++++++++++ .../behaviours/claim_subscription.py | 89 ++++++++++++++++++ .../behaviours/order_subscription.py | 91 ++----------------- .../skills/decision_maker_abci/payloads.py | 9 ++ .../skills/decision_maker_abci/rounds.py | 18 +++- .../skills/decision_maker_abci/skill.yaml | 26 ++++-- .../skills/decision_maker_abci/states/base.py | 10 ++ .../states/claim_subscription.py | 45 +++++++++ .../states/final_states.py | 3 + .../states/order_subscription.py | 11 ++- .../decision_maker_abci/utils/nevermined.py | 12 +++ .../skills/market_manager_abci/skill.yaml | 2 +- .../valory/skills/staking_abci/skill.yaml | 6 +- packages/valory/skills/trader_abci/skill.yaml | 18 ++-- .../tx_settlement_multiplexer_abci/skill.yaml | 6 +- 17 files changed, 337 insertions(+), 131 deletions(-) create mode 100644 packages/valory/skills/decision_maker_abci/behaviours/claim_subscription.py create mode 100644 packages/valory/skills/decision_maker_abci/states/claim_subscription.py diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index 1a57071ca..06a984a14 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -9,15 +9,15 @@ fingerprint: __init__.py: bafybeighcq4pmuzte6vhvvprrvo563vzghkoit2h6qdqxf2ma5bghevkee fingerprint_ignore_patterns: [] connections: -- valory/abci:0.1.0:bafybeiebojxskcarfxaq545xca3ylewmdnbsmgqzavss7ihbks4az7ifr4 +- valory/abci:0.1.0:bafybeih4lb2myvtypnfeji5jmgikmmazpgl3vyf5sy7oe66ji2zfjj6ily - valory/http_client:0.23.0:bafybeiddrfvomrmgvh5yuv2coq7ci72wcdf663stayi3m5aawnj4srggce -- valory/ipfs:0.1.0:bafybeidrfpktv4jwgjgpqdn3k63g7n3t46a7q2r2y6nn3icvpc2bu55jva +- valory/ipfs:0.1.0:bafybeigjtca6b5wwiobl37es3wllzt6ai3qef5gqxzfy5fmmc65jkbnec4 - valory/ledger:0.19.0:bafybeia47rr37ianvwsh77tjjpv3nwif5sywhhy2fbdshnz4a2icwln76a - valory/p2p_libp2p_client:0.1.0:bafybeihge56dn3xep2dzomu7rtvbgo4uc2qqh7ljl3fubqdi2lq44gs5lq contracts: -- valory/gnosis_safe:0.1.0:bafybeic54u6jwqicav2xtkm6kfb3udjvxzufch5z3vwoloe72a7sjlhgua -- valory/gnosis_safe_proxy_factory:0.1.0:bafybeianp36eoydshddii7f2qkdqjfb47ghabdofbpa4f4wndde2cuctpa -- valory/service_registry:0.1.0:bafybeig5dejsuyezds7uqlkcm3xz2pvxamsjmsjidwpwjv6zkkuafz3ex4 +- valory/gnosis_safe:0.1.0:bafybeiegkl6zrbvlbpwmoziw4hfkocjfqdqphkmpgow7ovsmv7bwa3f4pe +- valory/gnosis_safe_proxy_factory:0.1.0:bafybeiehjccqvhrcarhahhyyrshaifoipfqwvpxjucpucslp22l2wc3sl4 +- valory/service_registry:0.1.0:bafybeieeuruq7dp4b6souetv5ce7wlm52pw7vyrxuhqa7kuy5m3rwwxks4 - valory/market_maker:0.1.0:bafybeihcueo3ct3h5fqyrwsjeofr5winyxlnegnwdvofopwhrfzkhgpxte - valory/erc20:0.1.0:bafybeiecuaahlywb2rw6s76av5rdqg4gad6j753to6aqrix7zmbbt6kj6q - valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y @@ -37,17 +37,17 @@ protocols: - valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru - valory/tendermint:0.1.0:bafybeig6g6twajlwssfbfp5rlnu5mwzuu5kgak5cs4fich7rlkx6whesnu skills: -- valory/abstract_abci:0.1.0:bafybeigi7m5l6buucytkyu6rsz4rh7lj6wtvvgxxtn6uansj7lcxofvv5e -- valory/abstract_round_abci:0.1.0:bafybeidbmd2cgffqqfwsyxws5dffsc6nbt5ijgkbhyzse5i42yddmwqlpy -- valory/registration_abci:0.1.0:bafybeieylbkzk3zju6un3xysextycnj72aniq2britpvnniud4ekglcbbi -- valory/reset_pause_abci:0.1.0:bafybeida6w2afp4m3dvnbkbwxz67ozjlry3wpsbkxwz7usalm3o2ghy46u -- valory/termination_abci:0.1.0:bafybeid5ipudhwuiuhbzvpn4usgdm3a3ow3naafuefvetmgbbcy6ugyuwi -- valory/transaction_settlement_abci:0.1.0:bafybeidsfwslnbhhhplvgteeec7idrhm7gxpay4f36wwnkgl4mh7ogovke -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeia4je5sswi5djvrvlscbms5opten5uxzdcs64rysje4an4ylgitri -- valory/market_manager_abci:0.1.0:bafybeicqjiqq63bcb6colaq4adwsn7o6zhyd7n5ftwdv4kvt3rqxhnapw4 -- valory/decision_maker_abci:0.1.0:bafybeictykibll26pjydtfmg54hpyoebwx2linmiatohrwpgvd35lwmyha -- valory/trader_abci:0.1.0:bafybeigcnnr2dgdqofgcn2vxaqigek2qbytparxvryzjndxrpk4vovpnra -- valory/staking_abci:0.1.0:bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u +- valory/abstract_abci:0.1.0:bafybeial6drwstqlvuizgtouc4uqgxvutwryfu7yohondemd6bd7cw3jzm +- valory/abstract_round_abci:0.1.0:bafybeicrzndcdbue34yxwwb4hmmdhgzw4owcdcdag3ifj6thpx5wie3dp4 +- valory/registration_abci:0.1.0:bafybeihjlapvviakobxg7aa5qubgqoz6xurlhu7xxtnrg5ah3ag2qj626i +- valory/reset_pause_abci:0.1.0:bafybeibnwjcjx4lluf4cwb6es5peelu3gm7vrzlieygrzpbjlubxpvbvzy +- valory/termination_abci:0.1.0:bafybeifdtxgldw33kwvsavcituzewwbr6iqfcsgk5qouqfhpwdrivyyyom +- valory/transaction_settlement_abci:0.1.0:bafybeifpnkwgwpzz6uwrvfgurm26allr6shjfbp7bfbrxwy64sw3nf3fsa +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeig3u6zpilnariioqh26bg3pw5pfjagfgg7qox7c7rjtatlabv27ti +- valory/market_manager_abci:0.1.0:bafybeietn6vjbxbqvkf4rxodm3feh4ayaliltlxofnb5tiie5yo3cbspiq +- valory/decision_maker_abci:0.1.0:bafybeic25tlxaqalnyy4yj6bisa7ev7g34lazzrvis5yhet52biwp5cp2a +- valory/trader_abci:0.1.0:bafybeihhmypzsm4gdwi224nz4qagrx37cvi3gkbmccy26ydxppagzi4cyq +- valory/staking_abci:0.1.0:bafybeielt3ion6leloaj7anom4dmss3wp4exz4y3kwkx5sqj2rbxd6lsiy default_ledger: ethereum required_ledgers: - ethereum diff --git a/packages/valory/contracts/transfer_nft_condition/contract.yaml b/packages/valory/contracts/transfer_nft_condition/contract.yaml index d6b1143b3..f3c3d506a 100644 --- a/packages/valory/contracts/transfer_nft_condition/contract.yaml +++ b/packages/valory/contracts/transfer_nft_condition/contract.yaml @@ -6,10 +6,10 @@ description: TRANSFER_NFT_CONDITION token contract license: Apache-2.0 aea_version: '>=1.0.0, <2.0.0' fingerprint: - README.md: bafybeifmfma6rglvpa22odtozyosnp5mwljum64utxip2wgmezuhnjjjyi - __init__.py: bafybeia2k2vmq7lmd3uchmm6jmzj7ebqkogk5aolpw4nwsawnkgqfobltm - build/TransferNFTCondition.json: bafybeiemn5b5nszuss7xj6lmvmjuendltp6wz7ubihdvd7c6wqw4bohbpa - contract.py: bafybeif3vy43l7baa3doljavpfvy42mywkcgkvpvlilweluk5jf6e3doji + README.md: bafybeidiaep6cpoqlabnajvsgegpt72hqnbtozayicaxclzxzftopvlw5u + __init__.py: bafybeigr6fpkchrud5tjrx5qevyk436jufe4zt6otkpbzsiergvyp64hs4 + build/TransferNFTCondition.json: bafybeihjasxvef6utvcdboz2jmjlyldxaqjsakynpzxgfwzczcesoys22m + contract.py: bafybeihz5jeggunv4owoamcpgohs7qgnfjqicuxk3zv4hwbxzysnto3w7q fingerprint_ignore_patterns: [] contracts: [] class_name: TransferNftCondition diff --git a/packages/valory/skills/decision_maker_abci/behaviours/base.py b/packages/valory/skills/decision_maker_abci/behaviours/base.py index cd6f5fd24..bf93649b1 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/base.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/base.py @@ -20,6 +20,7 @@ """This module contains the base behaviour for the 'decision_maker_abci' skill.""" import dataclasses +import json from abc import ABC from datetime import datetime, timedelta from typing import Any, Callable, Dict, Generator, List, Optional, Set, Tuple, cast @@ -550,3 +551,84 @@ def finish_behaviour(self, payload: BaseTxPayload) -> Generator: yield from self.wait_until_round_end() self.set_done() + + +class BaseSubscriptionBehaviour(DecisionMakerBaseBehaviour, ABC): + @property + def subscription_params(self) -> Dict[str, Any]: + """Get the subscription params.""" + mech = self.params.mech_agent_address + return self.params.mech_to_subscription_params[mech] + + @property + def did(self) -> str: + """Get the did.""" + subscription_params = self.subscription_params + return subscription_params["did"] + + @property + def escrow_payment_condition_address(self) -> str: + """Get the escrow payment address.""" + subscription_params = self.subscription_params + return subscription_params["escrow_payment_condition_address"] + + @property + def lock_payment_condition_address(self) -> str: + """Get the lock payment address.""" + subscription_params = self.subscription_params + return subscription_params["lock_payment_condition_address"] + + @property + def transfer_nft_condition_address(self) -> str: + """Get the transfer nft condition address.""" + subscription_params = self.subscription_params + return subscription_params["transfer_nft_condition_address"] + + @property + def token_address(self) -> str: + """Get the token address.""" + subscription_params = self.subscription_params + return subscription_params["token"] + + @property + def purchase_amount(self) -> int: + """Get the purchase amount.""" + subscription_params = self.subscription_params + return subscription_params["nft_amount"] + + @property + def price(self) -> int: + """Get the price.""" + subscription_params = self.subscription_params + return subscription_params["price"] + + @property + def base_url(self) -> str: + """Get the base url.""" + subscription_params = self.subscription_params + return subscription_params["base_url"] + + def _resolve_did(self) -> Generator[None, None, Optional[Dict[str, Any]]]: + """Resolve and parse the did.""" + did_url = f"{self.base_url}/{self.did}" + response = yield from self.get_http_response( + method="GET", + url=did_url, + headers={"accept": "application/json"}, + ) + if response.status_code != 200: + self.context.logger.error( + f"Could not retrieve data from did url {did_url}. " + f"Received status code {response.status_code}." + ) + return None + try: + data = json.loads(response.body)["data"] + except (ValueError, TypeError) as e: + self.context.logger.error( + f"Could not parse response from nervermined api, " + f"the following error was encountered {type(e).__name__}: {e}" + ) + return None + + return data diff --git a/packages/valory/skills/decision_maker_abci/behaviours/claim_subscription.py b/packages/valory/skills/decision_maker_abci/behaviours/claim_subscription.py new file mode 100644 index 000000000..329602c8c --- /dev/null +++ b/packages/valory/skills/decision_maker_abci/behaviours/claim_subscription.py @@ -0,0 +1,89 @@ +# -*- coding: utf-8 -*- +# ------------------------------------------------------------------------------ +# +# Copyright 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 behaviour for the decision-making of the skill.""" +import json +from typing import Any, Generator + + +from packages.valory.skills.decision_maker_abci.behaviours.base import ( + BaseSubscriptionBehaviour, +) +from packages.valory.skills.decision_maker_abci.payloads import ClaimPayload +from packages.valory.skills.decision_maker_abci.states.claim_subscription import ClaimRound +from packages.valory.skills.decision_maker_abci.utils.nevermined import get_creator, get_claim_endpoint + +SERVICE_INDEX = -1 +ERC1155 = 1155 + + +class ClaimSubscriptionBehaviour(BaseSubscriptionBehaviour): + """A behaviour in which the agents claim the subscription they purchased.""" + + matching_round = ClaimRound + + def __init__(self, **kwargs: Any) -> None: + """Initialize `RedeemBehaviour`.""" + super().__init__(**kwargs) + self.order_tx: str = "" + self.approval_tx: str = "" + self.balance: int = 0 + + def _claim_subscription(self) -> Generator[None, None, bool]: + """Claim the subscription.""" + did_doc = yield from self._resolve_did() + if did_doc is None: + return False + + creator = get_creator(did_doc) + claim_endpoint = get_claim_endpoint(did_doc) + body = { + "agreementId": self.synchronized_data.agreement_id, + "did": self.did, + "nftHolder": creator, + "nftReceiver": self.synchronized_data.safe_contract_address, + "nftAmount": str(self.purchase_amount), + "nftType": ERC1155, + "serviceIndex": SERVICE_INDEX, + } + res = yield from self.get_http_response( + 'POST', + claim_endpoint, + json.dumps(body).encode(), + headers={'Content-Type': 'application/json'}, + ) + if res.status_code != 200: + self.context.logger.warning( + f'Failed to claim subscription: {res.status_code} - {res.body}', + ) + return False + + return True + + def async_act(self) -> Generator: + """Do the action.""" + + with self.context.benchmark_tool.measure(self.behaviour_id).local(): + claim = yield from self._claim_subscription() + sender = self.context.agent_address + payload = ClaimPayload( + sender, + vote=claim, + ) + yield from self.finish_behaviour(payload) diff --git a/packages/valory/skills/decision_maker_abci/behaviours/order_subscription.py b/packages/valory/skills/decision_maker_abci/behaviours/order_subscription.py index 69f91ba41..728676908 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/order_subscription.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/order_subscription.py @@ -27,11 +27,11 @@ from packages.valory.contracts.transfer_nft_condition.contract import TransferNftCondition from packages.valory.protocols.contract_api import ContractApiMessage from packages.valory.skills.decision_maker_abci.behaviours.base import ( - DecisionMakerBaseBehaviour, + DecisionMakerBaseBehaviour, BaseSubscriptionBehaviour, ) from packages.valory.skills.decision_maker_abci.models import MultisendBatch from packages.valory.skills.decision_maker_abci.payloads import DecisionReceivePayload, SubscriptionPayload -from packages.valory.skills.decision_maker_abci.states.purchase_subscription import SubscriptionRound +from packages.valory.skills.decision_maker_abci.states.order_subscription import SubscriptionRound from packages.valory.skills.decision_maker_abci.utils.nevermined import generate_id, zero_x_transformer, \ no_did_prefixed, get_lock_payment_seed, get_price, get_transfer_nft_condition_seed, get_escrow_payment_seed, \ get_timeouts_and_timelocks, get_reward_address @@ -41,7 +41,7 @@ -class PurchaseSubscriptionBehaviour(DecisionMakerBaseBehaviour): +class PurchaseSubscriptionBehaviour(BaseSubscriptionBehaviour): """A behaviour in which the agents purchase a subscriptions.""" matching_round = SubscriptionRound @@ -52,85 +52,7 @@ def __init__(self, **kwargs: Any) -> None: self.order_tx: str = "" self.approval_tx: str = "" self.balance: int = 0 - - @property - def subscription_params(self) -> Dict[str, Any]: - """Get the subscription params.""" - mech = self.params.mech_agent_address - return self.params.mech_to_subscription_params[mech] - - @property - def did(self) -> str: - """Get the did.""" - subscription_params = self.subscription_params - return subscription_params["did"] - - @property - def escrow_payment_condition_address(self) -> str: - """Get the escrow payment address.""" - subscription_params = self.subscription_params - return subscription_params["escrow_payment_condition_address"] - - @property - def lock_payment_condition_address(self) -> str: - """Get the lock payment address.""" - subscription_params = self.subscription_params - return subscription_params["lock_payment_condition_address"] - - @property - def transfer_nft_condition_address(self) -> str: - """Get the transfer nft condition address.""" - subscription_params = self.subscription_params - return subscription_params["transfer_nft_condition_address"] - - @property - def token_address(self) -> str: - """Get the token address.""" - subscription_params = self.subscription_params - return subscription_params["token"] - - @property - def purchase_amount(self) -> int: - """Get the purchase amount.""" - subscription_params = self.subscription_params - return subscription_params["nft_amount"] - - @property - def price(self) -> int: - """Get the price.""" - subscription_params = self.subscription_params - return subscription_params["price"] - - @property - def base_url(self) -> str: - """Get the base url.""" - subscription_params = self.subscription_params - return subscription_params["base_url"] - - def _resolve_did(self) -> Generator[None, None, Optional[Dict[str, Any]]]: - """Resolve and parse the did.""" - did_url = f"{self.base_url}/{self.did}" - response = yield from self.get_http_response( - method="GET", - url=did_url, - headers={"accept": "application/json"}, - ) - if response.status_code != 200: - self.context.logger.error( - f"Could not retrieve data from did url {did_url}. " - f"Received status code {response.status_code}." - ) - return None - try: - data = json.loads(response.body)["data"] - except (ValueError, TypeError) as e: - self.context.logger.error( - f"Could not parse response from nervermined api, " - f"the following error was encountered {type(e).__name__}: {e}" - ) - return None - - return data + self.agreement_id: str = "" def _get_condition_ids(self, did_doc: Dict[str, Any]) -> List[str]: """Get the condition ids.""" @@ -247,7 +169,7 @@ def _prepare_order_tx( self.multisend_batches.append( MultisendBatch( to=contract_address, - data=HexBytes(self.purchase_tx), + data=HexBytes(self.order_tx), ) ) @@ -306,6 +228,8 @@ def get_payload_content(self) -> Generator[None, None, str]: if not result: return SubscriptionRound.ERROR_PAYLOAD + self.agreement_id = approval_params["agreement_id"] + purchase_params = yield from self._get_purchase_params() if purchase_params is None: return SubscriptionRound.ERROR_PAYLOAD @@ -332,5 +256,6 @@ def async_act(self) -> Generator: sender, tx_submitter=SubscriptionRound.auto_round_id(), tx_hash=payload_data, + agreement_id=self.agreement_id, ) yield from self.finish_behaviour(payload) diff --git a/packages/valory/skills/decision_maker_abci/payloads.py b/packages/valory/skills/decision_maker_abci/payloads.py index 82d453f29..4f169ee8c 100644 --- a/packages/valory/skills/decision_maker_abci/payloads.py +++ b/packages/valory/skills/decision_maker_abci/payloads.py @@ -72,6 +72,15 @@ class RequestPayload(MultisigTxPayload): class SubscriptionPayload(MultisigTxPayload): """Represents a transaction payload for subscribing.""" + agreement_id: str = '' + + +@dataclass(frozen=True) +class ClaimPayload(BaseTxPayload): + """Represents a transaction payload for claiming a subscription.""" + + vote: bool + @dataclass(frozen=True) class VotingPayload(BaseTxPayload): diff --git a/packages/valory/skills/decision_maker_abci/rounds.py b/packages/valory/skills/decision_maker_abci/rounds.py index e2bf7c716..8a627b1af 100644 --- a/packages/valory/skills/decision_maker_abci/rounds.py +++ b/packages/valory/skills/decision_maker_abci/rounds.py @@ -37,6 +37,7 @@ from packages.valory.skills.decision_maker_abci.states.blacklisting import ( BlacklistingRound, ) +from packages.valory.skills.decision_maker_abci.states.claim_subscription import ClaimRound from packages.valory.skills.decision_maker_abci.states.decision_receive import ( DecisionReceiveRound, ) @@ -48,11 +49,12 @@ FinishedWithoutDecisionRound, FinishedWithoutRedeemingRound, ImpossibleRound, - RefillRequiredRound, + RefillRequiredRound, FinishedSubscriptionRound, ) from packages.valory.skills.decision_maker_abci.states.handle_failed_tx import ( HandleFailedTxRound, ) +from packages.valory.skills.decision_maker_abci.states.order_subscription import SubscriptionRound from packages.valory.skills.decision_maker_abci.states.redeem import RedeemRound from packages.valory.skills.decision_maker_abci.states.sampling import SamplingRound from packages.valory.skills.decision_maker_abci.states.tool_selection import ( @@ -135,6 +137,7 @@ class DecisionMakerAbciApp(AbciApp[Event]): HandleFailedTxRound, DecisionReceiveRound, RedeemRound, + ClaimRound, } transition_function: AbciAppTransitionFunction = { SamplingRound: { @@ -143,6 +146,18 @@ class DecisionMakerAbciApp(AbciApp[Event]): Event.NO_MAJORITY: SamplingRound, Event.ROUND_TIMEOUT: SamplingRound, }, + SubscriptionRound: { + Event.DONE: FinishedSubscriptionRound, + Event.SUBSCRIPTION_ERROR: SubscriptionRound, + Event.NO_MAJORITY: SubscriptionRound, + Event.ROUND_TIMEOUT: SubscriptionRound, + }, + ClaimRound: { + Event.DONE: ToolSelectionRound, + Event.SUBSCRIPTION_ERROR: ClaimRound, + Event.NO_MAJORITY: ClaimRound, + Event.ROUND_TIMEOUT: ClaimRound, + }, ToolSelectionRound: { Event.DONE: DecisionRequestRound, Event.NONE: ToolSelectionRound, @@ -213,6 +228,7 @@ class DecisionMakerAbciApp(AbciApp[Event]): ) final_states: Set[AppState] = { FinishedDecisionMakerRound, + FinishedSubscriptionRound, FinishedWithoutDecisionRound, FinishedWithoutRedeemingRound, RefillRequiredRound, diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index 2fe763e1f..0efbe76c8 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -12,12 +12,14 @@ fingerprint: README.md: bafybeia367zzdwndvlhw27rvnwodytjo3ms7gbc3q7mhrrjqjgfasnk47i __init__.py: bafybeih563ujnigeci2ldzh7hakbau6a222vsed7leg3b7lq32vcn3nm4a behaviours/__init__.py: bafybeih6ddz2ocvm6x6ytvlbcz6oi4snb5ee5xh5h65nq4w2qf7fd7zfky - behaviours/base.py: bafybeialr3zhwjenpwp6tu74olnzghtzmuofymidhwekkvhe7uskwczrii + behaviours/base.py: bafybeif7fbndiwrd3azurflytki5e3rj5yvsydohdrqoslcd5ubpxkubyi behaviours/bet_placement.py: bafybeigtz4uimsqjjwq4r5p3a5v6niqdtqezbuf2ghy6o7syhsh4k5gjfa behaviours/blacklisting.py: bafybeierwdzn6vav54l6zym77hhx2vdx3jtnnwpbhwmwwyrqzncwjwkxu4 + behaviours/claim_subscription.py: bafybeibied3wtszqohpbox4ztojjxtkbn3eg7rsp4qn2pgkqjgzjoz47qa behaviours/decision_receive.py: bafybeidvae35fzdmf2hvn3lqkc67zgjy5enu3vi3z5duomlqmf2v4zvxza behaviours/decision_request.py: bafybeidhmhjxt5xjhznxchqqqh6ohdssyyyzuqxv6dfdvpza7c2bxigajq behaviours/handle_failed_tx.py: bafybeidxpc6u575ymct5tdwutvzov6zqfdoio5irgldn3fw7q3lg36mmxm + behaviours/order_subscription.py: bafybeibjxiammauydlmnrkqu2hyw74v3ftxnb476kimcrqzfwmr65hijlq behaviours/reedem.py: bafybeibenzbek5qdtk3gobjxfmsm6tg6i3d4yltozymy23izpgbcpal5ye behaviours/round_behaviour.py: bafybeig4tdktyu6hapoqymnxh2bgpds547st6a44heue657wkctwe4gjvm behaviours/sampling.py: bafybeifzhm4sspdvt227ksl5hjn26offgqpwempgbcwbr6dq7gyi2a46sm @@ -27,19 +29,21 @@ fingerprint: handlers.py: bafybeiggoetspwcvdojmbjdd67tmkoeedikmt6vsbcium3zjaljb6jzqu4 io_/__init__.py: bafybeifxgmmwjqzezzn3e6keh2bfo4cyo7y5dq2ept3stfmgglbrzfl5rq io_/loader.py: bafybeih3sdsx5dhe4kzhtoafexjgkutsujwqy3zcdrlrkhtdks45bc7exa - models.py: bafybeif63pruksc6fpvmg77jmsrphc36uiawypzzcrk6nbpzoglbpxnlfy - payloads.py: bafybeigcic4vewdglakzpyqevhfwsolh4ywnbvxo5bgned7gl5uo3jif7m + models.py: bafybeicug6vzpphd5e5paicaf5ewk3nhyrs7zlq77zkppgnbfhrpiyn5ye + payloads.py: bafybeiet7nycjiafyom4autm36ve3x74woi74aljhaxviwlja5kvpt2p6i policy.py: bafybeidpmx4ek3qze63zpuwixyf6t7bdv62ewgkzt3ljrzadiwdw64cueq redeem_info.py: bafybeifiiix4gihfo4avraxt34sfw35v6dqq45do2drrssei2shbps63mm - rounds.py: bafybeifvov25vwzbbzgg4zvtptsnqve7t7hbjq3b7wuhie4fdwq2e7th7q + rounds.py: bafybeicnh2kfdxjmmrfia3cuelxdjwozmv3ul24kn7z4njrfddyv3dugju states/__init__.py: bafybeid23llnyp6j257dluxmrnztugo5llsrog7kua53hllyktz4dqhqoy - states/base.py: bafybeibhcc4pc3m6qelvdvxssnuglcwfaff55cr2kule74ekauyf3bahpq + states/base.py: bafybeib3y5pmt52i747wxpnc7spwbrqim32vgju5ln46e22h4qvowhysom states/bet_placement.py: bafybeibalhxhp2c4oljmiwqi6ds3g36fgtabmf42mb5sgq6z22znrcbhda states/blacklisting.py: bafybeifruvxwwltndwazkzzbpc5nnnad3z5t5ofy6d3i7nssljbxl6gvxu + states/claim_subscription.py: bafybeigmxodnmvqll7tsnf73k3co6lrqvk6eu5aktwwc3d45a4zvm52vha states/decision_receive.py: bafybeib3roo27nccj4eylaqwwzztzzzwsi6px5atjrch5wbqmpln2kyy6y states/decision_request.py: bafybeic7otc3hjb753svbmur3yyk6szahc25yii3x4w4vcnpfz6jwvacuu - states/final_states.py: bafybeidiwhuyd5zm2cq7vhv2owcrxdpm7fnvn3db6p6tql4jz5hgpalflu + states/final_states.py: bafybeibo7x5dhkdp7qbq67z66t2vhjldea37stobjwbwoll3ai7oetbblm states/handle_failed_tx.py: bafybeihewm2vernvhktuorljdupjqcg2p5vs6wvsira2d62wkoyo5xlzjm + states/order_subscription.py: bafybeiajexthafj62delvh4mzhvqu7t2n4qtdv4qnwmwxefl3tgtfhkgr4 states/redeem.py: bafybeiblidmpt73ocac73wmakusrnf5267vs7s2foc5pqkrz4vuqgy3b4u states/sampling.py: bafybeidnvdogjlthjfe7jpaiuezm3xydrbxxukyoss4gx6t5fdin52rsta states/tool_selection.py: bafybeiaaijv6dukp3bmsptcwkcmumc6wu6ztzkvaqzsqqjbfn4ozgyuykq @@ -47,10 +51,12 @@ fingerprint: tests/behaviours/__init__.py: bafybeic7icz7lfhfepdkqkase7y7zn3a6pwdw6fx4ah2hajmgejawpolc4 tests/behaviours/test_base.py: bafybeidemmwjhtr6i4tq66jyqkpmb425ersfmk7k7zzjmeaz2idqnpcwve tests/conftest.py: bafybeidy5hw56kw5mxudnfbhvogofn6k4rqb4ux2bd45baedrrhmgyrude + utils/__init__.py: bafybeihrz3vkiyvvkona4tv4zchmyyserjhmq33u753t4k62a2rd3mtuiq + utils/nevermined.py: bafybeia7i7oqv5wlcdinyo7f6baanee7gx6zm4w3yqpp5tkpzxpgy4gmmq fingerprint_ignore_patterns: [] connections: [] contracts: -- valory/gnosis_safe:0.1.0:bafybeic54u6jwqicav2xtkm6kfb3udjvxzufch5z3vwoloe72a7sjlhgua +- valory/gnosis_safe:0.1.0:bafybeiegkl6zrbvlbpwmoziw4hfkocjfqdqphkmpgow7ovsmv7bwa3f4pe - valory/market_maker:0.1.0:bafybeihcueo3ct3h5fqyrwsjeofr5winyxlnegnwdvofopwhrfzkhgpxte - valory/erc20:0.1.0:bafybeiecuaahlywb2rw6s76av5rdqg4gad6j753to6aqrix7zmbbt6kj6q - valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y @@ -64,9 +70,9 @@ protocols: - valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru - valory/ipfs:0.1.0:bafybeiedxeismnx3k5ty4mvvhlqideixlhqmi5mtcki4lxqfa7uqh7p33u skills: -- valory/abstract_round_abci:0.1.0:bafybeidbmd2cgffqqfwsyxws5dffsc6nbt5ijgkbhyzse5i42yddmwqlpy -- valory/market_manager_abci:0.1.0:bafybeicqjiqq63bcb6colaq4adwsn7o6zhyd7n5ftwdv4kvt3rqxhnapw4 -- valory/transaction_settlement_abci:0.1.0:bafybeidsfwslnbhhhplvgteeec7idrhm7gxpay4f36wwnkgl4mh7ogovke +- valory/abstract_round_abci:0.1.0:bafybeicrzndcdbue34yxwwb4hmmdhgzw4owcdcdag3ifj6thpx5wie3dp4 +- valory/market_manager_abci:0.1.0:bafybeietn6vjbxbqvkf4rxodm3feh4ayaliltlxofnb5tiie5yo3cbspiq +- valory/transaction_settlement_abci:0.1.0:bafybeifpnkwgwpzz6uwrvfgurm26allr6shjfbp7bfbrxwy64sw3nf3fsa behaviours: main: args: {} diff --git a/packages/valory/skills/decision_maker_abci/states/base.py b/packages/valory/skills/decision_maker_abci/states/base.py index c4ed29bd1..ce28c63a6 100644 --- a/packages/valory/skills/decision_maker_abci/states/base.py +++ b/packages/valory/skills/decision_maker_abci/states/base.py @@ -174,6 +174,16 @@ def participant_to_tx_prep(self) -> DeserializedCollection: """Get the participants to bet-placement.""" return self._get_deserialized("participant_to_tx_prep") + @property + def agreement_id(self) -> str: + """Get the agreement id.""" + return str(self.db.get_strict("agreement_id")) + + @property + def claim(self) -> bool: + """Get the claim.""" + return bool(self.db.get_strict("claim")) + class TxPreparationRound(CollectSameUntilThresholdRound): """A round for preparing a transaction.""" diff --git a/packages/valory/skills/decision_maker_abci/states/claim_subscription.py b/packages/valory/skills/decision_maker_abci/states/claim_subscription.py new file mode 100644 index 000000000..7a9f76bf5 --- /dev/null +++ b/packages/valory/skills/decision_maker_abci/states/claim_subscription.py @@ -0,0 +1,45 @@ +# -*- 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 decision receiving state of the decision-making abci app.""" + +from enum import Enum +from typing import Optional, Tuple, cast, Type + +from packages.valory.skills.abstract_round_abci.base import ( + CollectSameUntilThresholdRound, + get_name, BaseSynchronizedData, VotingRound, +) +from packages.valory.skills.decision_maker_abci.payloads import DecisionReceivePayload, MultisigTxPayload, \ + SubscriptionPayload, ClaimPayload +from packages.valory.skills.decision_maker_abci.states.base import ( + Event, + SynchronizedData, TxPreparationRound, +) + + +class ClaimRound(VotingRound): + """A round for preparing a transaction.""" + + payload_class = ClaimPayload + synchronized_data_class = SynchronizedData + done_event = Event.DONE + negative_event = Event.SUBSCRIPTION_ERROR + no_majority_event = Event.NO_MAJORITY + collection_key = get_name(SynchronizedData.participant_to_votes) diff --git a/packages/valory/skills/decision_maker_abci/states/final_states.py b/packages/valory/skills/decision_maker_abci/states/final_states.py index e5c57043d..e2f213cb1 100644 --- a/packages/valory/skills/decision_maker_abci/states/final_states.py +++ b/packages/valory/skills/decision_maker_abci/states/final_states.py @@ -25,6 +25,9 @@ class FinishedDecisionMakerRound(DegenerateRound): """A round representing that decision-making has finished.""" +class FinishedSubscriptionRound(DegenerateRound): + """A round representing that subscription has finished.""" + class FinishedWithoutRedeemingRound(DegenerateRound): """A round representing that decision-making has finished without redeeming.""" diff --git a/packages/valory/skills/decision_maker_abci/states/order_subscription.py b/packages/valory/skills/decision_maker_abci/states/order_subscription.py index 48b8240e3..e442ec894 100644 --- a/packages/valory/skills/decision_maker_abci/states/order_subscription.py +++ b/packages/valory/skills/decision_maker_abci/states/order_subscription.py @@ -56,4 +56,13 @@ def end_block(self) -> Optional[Tuple[BaseSynchronizedData, Enum]]: if payload.tx_hash == self.NO_TX_PAYLOAD: return self.synchronized_data, Event.NO_SUBSCRIPTION - return super().end_block() + update = super().end_block() + if update is None: + return None + + sync_data, event = update + payload = cast(SubscriptionPayload, self.most_voted_payload) + sync_data = sync_data.update( + agreement_id=payload.agreement_id, + ) + return sync_data, event diff --git a/packages/valory/skills/decision_maker_abci/utils/nevermined.py b/packages/valory/skills/decision_maker_abci/utils/nevermined.py index c2713532f..c77dccfd1 100644 --- a/packages/valory/skills/decision_maker_abci/utils/nevermined.py +++ b/packages/valory/skills/decision_maker_abci/utils/nevermined.py @@ -244,11 +244,23 @@ def get_reward_address(did_doc: Dict[str, Any], type: str = 'nft-sales') -> str: return contract_param if contract_param is not None else '' +def get_creator(did_doc: Dict[str, Any]) -> str: + """Get the creator of a DID.""" + return did_doc['proof']['creator'] + +def get_claim_endpoint(did_doc: Dict[str, Any]) -> str: + """Get the claim endpoint of a DID.""" + service = find_service_by_type(did_doc, 'nft-sales') + return service['serviceEndpoint'] + + + # TODO: remove res = requests.get('https://marketplace-api.gnosis.nevermined.app/api/v1/metadata/assets/ddo/did:nv:416e35cb209ecbfbf23e1192557b06e94c5d9a9afb025cce2e9baff23e907195') did_doc = res.json() price = get_price(did_doc) print(get_reward_address(did_doc)) +print(get_claim_endpoint(did_doc)) seed = get_lock_payment_seed( did_doc, '0x5e1d1eb61e1164d5a50b28c575da73a29595dff7', diff --git a/packages/valory/skills/market_manager_abci/skill.yaml b/packages/valory/skills/market_manager_abci/skill.yaml index 6abac78ff..a9fd360c0 100644 --- a/packages/valory/skills/market_manager_abci/skill.yaml +++ b/packages/valory/skills/market_manager_abci/skill.yaml @@ -30,7 +30,7 @@ connections: [] contracts: [] protocols: [] skills: -- valory/abstract_round_abci:0.1.0:bafybeidbmd2cgffqqfwsyxws5dffsc6nbt5ijgkbhyzse5i42yddmwqlpy +- valory/abstract_round_abci:0.1.0:bafybeicrzndcdbue34yxwwb4hmmdhgzw4owcdcdag3ifj6thpx5wie3dp4 behaviours: main: args: {} diff --git a/packages/valory/skills/staking_abci/skill.yaml b/packages/valory/skills/staking_abci/skill.yaml index f75a7a90b..a80932e8c 100644 --- a/packages/valory/skills/staking_abci/skill.yaml +++ b/packages/valory/skills/staking_abci/skill.yaml @@ -18,13 +18,13 @@ fingerprint: fingerprint_ignore_patterns: [] connections: [] contracts: -- valory/gnosis_safe:0.1.0:bafybeic54u6jwqicav2xtkm6kfb3udjvxzufch5z3vwoloe72a7sjlhgua +- valory/gnosis_safe:0.1.0:bafybeiegkl6zrbvlbpwmoziw4hfkocjfqdqphkmpgow7ovsmv7bwa3f4pe - valory/service_staking_token:0.1.0:bafybeidhtmaaktcmg5j64e4btca4ngb67w7wjsecn55xcdcd6qmdg66ty4 protocols: - valory/contract_api:1.0.0:bafybeialhbjvwiwcnqq3ysxcyemobcbie7xza66gaofcvla5njezkvhcka skills: -- valory/abstract_round_abci:0.1.0:bafybeidbmd2cgffqqfwsyxws5dffsc6nbt5ijgkbhyzse5i42yddmwqlpy -- valory/transaction_settlement_abci:0.1.0:bafybeidsfwslnbhhhplvgteeec7idrhm7gxpay4f36wwnkgl4mh7ogovke +- valory/abstract_round_abci:0.1.0:bafybeicrzndcdbue34yxwwb4hmmdhgzw4owcdcdag3ifj6thpx5wie3dp4 +- valory/transaction_settlement_abci:0.1.0:bafybeifpnkwgwpzz6uwrvfgurm26allr6shjfbp7bfbrxwy64sw3nf3fsa behaviours: main: args: {} diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index 5bb683494..9c9a6f042 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -19,15 +19,15 @@ connections: [] contracts: [] protocols: [] skills: -- valory/abstract_round_abci:0.1.0:bafybeidbmd2cgffqqfwsyxws5dffsc6nbt5ijgkbhyzse5i42yddmwqlpy -- valory/registration_abci:0.1.0:bafybeieylbkzk3zju6un3xysextycnj72aniq2britpvnniud4ekglcbbi -- valory/reset_pause_abci:0.1.0:bafybeida6w2afp4m3dvnbkbwxz67ozjlry3wpsbkxwz7usalm3o2ghy46u -- valory/transaction_settlement_abci:0.1.0:bafybeidsfwslnbhhhplvgteeec7idrhm7gxpay4f36wwnkgl4mh7ogovke -- valory/termination_abci:0.1.0:bafybeid5ipudhwuiuhbzvpn4usgdm3a3ow3naafuefvetmgbbcy6ugyuwi -- valory/market_manager_abci:0.1.0:bafybeicqjiqq63bcb6colaq4adwsn7o6zhyd7n5ftwdv4kvt3rqxhnapw4 -- valory/decision_maker_abci:0.1.0:bafybeictykibll26pjydtfmg54hpyoebwx2linmiatohrwpgvd35lwmyha -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeia4je5sswi5djvrvlscbms5opten5uxzdcs64rysje4an4ylgitri -- valory/staking_abci:0.1.0:bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u +- valory/abstract_round_abci:0.1.0:bafybeicrzndcdbue34yxwwb4hmmdhgzw4owcdcdag3ifj6thpx5wie3dp4 +- valory/registration_abci:0.1.0:bafybeihjlapvviakobxg7aa5qubgqoz6xurlhu7xxtnrg5ah3ag2qj626i +- valory/reset_pause_abci:0.1.0:bafybeibnwjcjx4lluf4cwb6es5peelu3gm7vrzlieygrzpbjlubxpvbvzy +- valory/transaction_settlement_abci:0.1.0:bafybeifpnkwgwpzz6uwrvfgurm26allr6shjfbp7bfbrxwy64sw3nf3fsa +- valory/termination_abci:0.1.0:bafybeifdtxgldw33kwvsavcituzewwbr6iqfcsgk5qouqfhpwdrivyyyom +- valory/market_manager_abci:0.1.0:bafybeietn6vjbxbqvkf4rxodm3feh4ayaliltlxofnb5tiie5yo3cbspiq +- valory/decision_maker_abci:0.1.0:bafybeic25tlxaqalnyy4yj6bisa7ev7g34lazzrvis5yhet52biwp5cp2a +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeig3u6zpilnariioqh26bg3pw5pfjagfgg7qox7c7rjtatlabv27ti +- valory/staking_abci:0.1.0:bafybeielt3ion6leloaj7anom4dmss3wp4exz4y3kwkx5sqj2rbxd6lsiy behaviours: main: args: {} diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index d1db46fce..832166c0d 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -20,9 +20,9 @@ contracts: [] protocols: - valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru skills: -- valory/abstract_round_abci:0.1.0:bafybeidbmd2cgffqqfwsyxws5dffsc6nbt5ijgkbhyzse5i42yddmwqlpy -- valory/decision_maker_abci:0.1.0:bafybeictykibll26pjydtfmg54hpyoebwx2linmiatohrwpgvd35lwmyha -- valory/staking_abci:0.1.0:bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u +- valory/abstract_round_abci:0.1.0:bafybeicrzndcdbue34yxwwb4hmmdhgzw4owcdcdag3ifj6thpx5wie3dp4 +- valory/decision_maker_abci:0.1.0:bafybeic25tlxaqalnyy4yj6bisa7ev7g34lazzrvis5yhet52biwp5cp2a +- valory/staking_abci:0.1.0:bafybeielt3ion6leloaj7anom4dmss3wp4exz4y3kwkx5sqj2rbxd6lsiy behaviours: main: args: {} From 3f93328b944799cb3ab77e907f3069dbc4365de7 Mon Sep 17 00:00:00 2001 From: Ardian Date: Thu, 18 Jan 2024 12:17:27 +0100 Subject: [PATCH 05/12] chore: package lock --- packages/packages.json | 13 ++-- packages/valory/agents/trader/aea-config.yaml | 32 ++++----- .../build/TransferNFTCondition.json | 72 +++++-------------- packages/valory/services/trader/service.yaml | 2 +- .../behaviours/order_subscription.py | 2 +- .../behaviours/round_behaviour.py | 4 ++ .../skills/decision_maker_abci/skill.yaml | 12 ++-- .../skills/market_manager_abci/skill.yaml | 2 +- .../valory/skills/staking_abci/skill.yaml | 6 +- .../valory/skills/trader_abci/composition.py | 3 +- packages/valory/skills/trader_abci/skill.yaml | 20 +++--- .../tx_settlement_multiplexer_abci/skill.yaml | 6 +- 12 files changed, 73 insertions(+), 101 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index 400310b17..695061e78 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -1,20 +1,21 @@ { "dev": { "skill/valory/market_manager_abci/0.1.0": "bafybeicqjiqq63bcb6colaq4adwsn7o6zhyd7n5ftwdv4kvt3rqxhnapw4", - "skill/valory/decision_maker_abci/0.1.0": "bafybeictykibll26pjydtfmg54hpyoebwx2linmiatohrwpgvd35lwmyha", - "skill/valory/trader_abci/0.1.0": "bafybeigcnnr2dgdqofgcn2vxaqigek2qbytparxvryzjndxrpk4vovpnra", + "skill/valory/decision_maker_abci/0.1.0": "bafybeih72hy7st6muq6ojfawtmrndafwkq4v36mp3cula23tt255yus2je", + "skill/valory/trader_abci/0.1.0": "bafybeibm6uqtpwyiya3hirg2rqyfkm7ma5mx5zi52ilqgbwmd6zcpvfxmu", "contract/valory/market_maker/0.1.0": "bafybeihcueo3ct3h5fqyrwsjeofr5winyxlnegnwdvofopwhrfzkhgpxte", - "agent/valory/trader/0.1.0": "bafybeihae4lqokbjzcu5reb4w7cf5xy6fuibkejjqw24chdraqqlpbvpwu", - "service/valory/trader/0.1.0": "bafybeic2o3oubopugb3p457gwnknnou3xaxo2uvycvnayfxd7rioi3i2si", + "agent/valory/trader/0.1.0": "bafybeihn546kbsi4o5jkvgl7ngpjcfjhapquhur22zruewxsni3o7hfivy", + "service/valory/trader/0.1.0": "bafybeievbiavkfiv2ekfxpn6pmu55az75igjl2o7rz2alhrg6iah4pkt2a", "contract/valory/erc20/0.1.0": "bafybeiecuaahlywb2rw6s76av5rdqg4gad6j753to6aqrix7zmbbt6kj6q", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeia4je5sswi5djvrvlscbms5opten5uxzdcs64rysje4an4ylgitri", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeighevqttuxh2zy5eux6ff24clan2het472th57mjub2onn6qq3oe4", "contract/valory/mech/0.1.0": "bafybeigmkbovcb6wcfqkkmmryo6kzqsai5qq325lzmsvtlxe4fn6rcmwoy", "contract/valory/realitio/0.1.0": "bafybeic5ie4oodetj4krdogydvbfxg4qggc3matpiflocah626tpevpreq", "contract/valory/realitio_proxy/0.1.0": "bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4", "contract/valory/conditional_tokens/0.1.0": "bafybeigucumqbsk74nj4rpm4p2cpiky4dj6uws7nfmgpimuviaxcamwqnu", "contract/valory/agent_registry/0.1.0": "bafybeib5czj6b3q6cukykbddo2nmn7etgmle53erq7ucapz5o7dzunno4a", "contract/valory/service_staking_token/0.1.0": "bafybeidhtmaaktcmg5j64e4btca4ngb67w7wjsecn55xcdcd6qmdg66ty4", - "skill/valory/staking_abci/0.1.0": "bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u" + "skill/valory/staking_abci/0.1.0": "bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u", + "contract/valory/transfer_nft_condition/0.1.0": "bafybeibl4xi2we6fpolemdroaoz4rka7ck3pcff5blyag3cq2kdxnd7iyq" }, "third_party": { "protocol/open_aea/signing/1.0.0": "bafybeie7xyems76v5b4wc2lmaidcujizpxfzjnnwdeokmhje53g7ym25ii", diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index 06a984a14..99193ee27 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -9,15 +9,15 @@ fingerprint: __init__.py: bafybeighcq4pmuzte6vhvvprrvo563vzghkoit2h6qdqxf2ma5bghevkee fingerprint_ignore_patterns: [] connections: -- valory/abci:0.1.0:bafybeih4lb2myvtypnfeji5jmgikmmazpgl3vyf5sy7oe66ji2zfjj6ily +- valory/abci:0.1.0:bafybeiebojxskcarfxaq545xca3ylewmdnbsmgqzavss7ihbks4az7ifr4 - valory/http_client:0.23.0:bafybeiddrfvomrmgvh5yuv2coq7ci72wcdf663stayi3m5aawnj4srggce -- valory/ipfs:0.1.0:bafybeigjtca6b5wwiobl37es3wllzt6ai3qef5gqxzfy5fmmc65jkbnec4 +- valory/ipfs:0.1.0:bafybeidrfpktv4jwgjgpqdn3k63g7n3t46a7q2r2y6nn3icvpc2bu55jva - valory/ledger:0.19.0:bafybeia47rr37ianvwsh77tjjpv3nwif5sywhhy2fbdshnz4a2icwln76a - valory/p2p_libp2p_client:0.1.0:bafybeihge56dn3xep2dzomu7rtvbgo4uc2qqh7ljl3fubqdi2lq44gs5lq contracts: -- valory/gnosis_safe:0.1.0:bafybeiegkl6zrbvlbpwmoziw4hfkocjfqdqphkmpgow7ovsmv7bwa3f4pe -- valory/gnosis_safe_proxy_factory:0.1.0:bafybeiehjccqvhrcarhahhyyrshaifoipfqwvpxjucpucslp22l2wc3sl4 -- valory/service_registry:0.1.0:bafybeieeuruq7dp4b6souetv5ce7wlm52pw7vyrxuhqa7kuy5m3rwwxks4 +- valory/gnosis_safe:0.1.0:bafybeic54u6jwqicav2xtkm6kfb3udjvxzufch5z3vwoloe72a7sjlhgua +- valory/gnosis_safe_proxy_factory:0.1.0:bafybeianp36eoydshddii7f2qkdqjfb47ghabdofbpa4f4wndde2cuctpa +- valory/service_registry:0.1.0:bafybeig5dejsuyezds7uqlkcm3xz2pvxamsjmsjidwpwjv6zkkuafz3ex4 - valory/market_maker:0.1.0:bafybeihcueo3ct3h5fqyrwsjeofr5winyxlnegnwdvofopwhrfzkhgpxte - valory/erc20:0.1.0:bafybeiecuaahlywb2rw6s76av5rdqg4gad6j753to6aqrix7zmbbt6kj6q - valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y @@ -37,17 +37,17 @@ protocols: - valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru - valory/tendermint:0.1.0:bafybeig6g6twajlwssfbfp5rlnu5mwzuu5kgak5cs4fich7rlkx6whesnu skills: -- valory/abstract_abci:0.1.0:bafybeial6drwstqlvuizgtouc4uqgxvutwryfu7yohondemd6bd7cw3jzm -- valory/abstract_round_abci:0.1.0:bafybeicrzndcdbue34yxwwb4hmmdhgzw4owcdcdag3ifj6thpx5wie3dp4 -- valory/registration_abci:0.1.0:bafybeihjlapvviakobxg7aa5qubgqoz6xurlhu7xxtnrg5ah3ag2qj626i -- valory/reset_pause_abci:0.1.0:bafybeibnwjcjx4lluf4cwb6es5peelu3gm7vrzlieygrzpbjlubxpvbvzy -- valory/termination_abci:0.1.0:bafybeifdtxgldw33kwvsavcituzewwbr6iqfcsgk5qouqfhpwdrivyyyom -- valory/transaction_settlement_abci:0.1.0:bafybeifpnkwgwpzz6uwrvfgurm26allr6shjfbp7bfbrxwy64sw3nf3fsa -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeig3u6zpilnariioqh26bg3pw5pfjagfgg7qox7c7rjtatlabv27ti -- valory/market_manager_abci:0.1.0:bafybeietn6vjbxbqvkf4rxodm3feh4ayaliltlxofnb5tiie5yo3cbspiq -- valory/decision_maker_abci:0.1.0:bafybeic25tlxaqalnyy4yj6bisa7ev7g34lazzrvis5yhet52biwp5cp2a -- valory/trader_abci:0.1.0:bafybeihhmypzsm4gdwi224nz4qagrx37cvi3gkbmccy26ydxppagzi4cyq -- valory/staking_abci:0.1.0:bafybeielt3ion6leloaj7anom4dmss3wp4exz4y3kwkx5sqj2rbxd6lsiy +- valory/abstract_abci:0.1.0:bafybeigi7m5l6buucytkyu6rsz4rh7lj6wtvvgxxtn6uansj7lcxofvv5e +- valory/abstract_round_abci:0.1.0:bafybeidbmd2cgffqqfwsyxws5dffsc6nbt5ijgkbhyzse5i42yddmwqlpy +- valory/registration_abci:0.1.0:bafybeieylbkzk3zju6un3xysextycnj72aniq2britpvnniud4ekglcbbi +- valory/reset_pause_abci:0.1.0:bafybeida6w2afp4m3dvnbkbwxz67ozjlry3wpsbkxwz7usalm3o2ghy46u +- valory/termination_abci:0.1.0:bafybeid5ipudhwuiuhbzvpn4usgdm3a3ow3naafuefvetmgbbcy6ugyuwi +- valory/transaction_settlement_abci:0.1.0:bafybeidsfwslnbhhhplvgteeec7idrhm7gxpay4f36wwnkgl4mh7ogovke +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeighevqttuxh2zy5eux6ff24clan2het472th57mjub2onn6qq3oe4 +- valory/market_manager_abci:0.1.0:bafybeicqjiqq63bcb6colaq4adwsn7o6zhyd7n5ftwdv4kvt3rqxhnapw4 +- valory/decision_maker_abci:0.1.0:bafybeih72hy7st6muq6ojfawtmrndafwkq4v36mp3cula23tt255yus2je +- valory/trader_abci:0.1.0:bafybeibm6uqtpwyiya3hirg2rqyfkm7ma5mx5zi52ilqgbwmd6zcpvfxmu +- valory/staking_abci:0.1.0:bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u default_ledger: ethereum required_ledgers: - ethereum diff --git a/packages/valory/contracts/transfer_nft_condition/build/TransferNFTCondition.json b/packages/valory/contracts/transfer_nft_condition/build/TransferNFTCondition.json index c10d67b1b..42e053679 100644 --- a/packages/valory/contracts/transfer_nft_condition/build/TransferNFTCondition.json +++ b/packages/valory/contracts/transfer_nft_condition/build/TransferNFTCondition.json @@ -1020,59 +1020,25 @@ "type": "function" }, { - "inputs": [ - { - "components": [ - { - "internalType": "bytes32", - "name": "did", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "nftHolder", - "type": "address" - }, - { - "internalType": "address", - "name": "nftReceiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "nftAmount", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "lockCondition", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "nftContractAddress", - "type": "address" - }, - { - "internalType": "bool", - "name": "transfer", - "type": "bool" - } - ], - "internalType": "struct EscrowComputeExecutionCondition.FulfillArgs", - "name": "_fulfillArgs", - "type": "tuple" - }, - { - "internalType": "bytes", - "name": "_signature", - "type": "bytes" - } - ], - "name": "createAgreementAndPayEscrow" - "outputs": [], - "stateMutability": "payable", - "type": "function" + "constant": false, + "inputs": [ + {"name": "_id", "type": "bytes32"}, + {"name": "_did", "type": "bytes32"}, + {"name": "_conditionIds", "type": "bytes32[]"}, + {"name": "_timeLocks", "type": "uint256[]"}, + {"name": "_timeOuts", "type": "uint256[]"}, + {"name": "_accessConsumer", "type": "address"}, + {"name": "_idx", "type": "uint256"}, + {"name": "_rewardAddress", "type": "address"}, + {"name": "_tokenAddress", "type": "address"}, + {"name": "_amounts", "type": "uint256[]"}, + {"name": "_receivers", "type": "address[]"} + ], + "name": "createAgreementAndPayEscrow", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" } ], "bytecode": "", diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index 94709b37b..1419d406b 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeihae4lqokbjzcu5reb4w7cf5xy6fuibkejjqw24chdraqqlpbvpwu +agent: valory/trader:0.1.0:bafybeihn546kbsi4o5jkvgl7ngpjcfjhapquhur22zruewxsni3o7hfivy number_of_agents: 4 deployment: {} --- diff --git a/packages/valory/skills/decision_maker_abci/behaviours/order_subscription.py b/packages/valory/skills/decision_maker_abci/behaviours/order_subscription.py index 728676908..9157717cf 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/order_subscription.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/order_subscription.py @@ -41,7 +41,7 @@ -class PurchaseSubscriptionBehaviour(BaseSubscriptionBehaviour): +class OrderSubscriptionBehaviour(BaseSubscriptionBehaviour): """A behaviour in which the agents purchase a subscriptions.""" matching_round = SubscriptionRound diff --git a/packages/valory/skills/decision_maker_abci/behaviours/round_behaviour.py b/packages/valory/skills/decision_maker_abci/behaviours/round_behaviour.py index af7643e54..bad7e151d 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/round_behaviour.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/round_behaviour.py @@ -31,6 +31,7 @@ from packages.valory.skills.decision_maker_abci.behaviours.blacklisting import ( BlacklistingBehaviour, ) +from packages.valory.skills.decision_maker_abci.behaviours.claim_subscription import ClaimSubscriptionBehaviour from packages.valory.skills.decision_maker_abci.behaviours.decision_receive import ( DecisionReceiveBehaviour, ) @@ -40,6 +41,7 @@ from packages.valory.skills.decision_maker_abci.behaviours.handle_failed_tx import ( HandleFailedTxBehaviour, ) +from packages.valory.skills.decision_maker_abci.behaviours.order_subscription import OrderSubscriptionBehaviour from packages.valory.skills.decision_maker_abci.behaviours.reedem import RedeemBehaviour from packages.valory.skills.decision_maker_abci.behaviours.sampling import ( SamplingBehaviour, @@ -64,4 +66,6 @@ class AgentDecisionMakerRoundBehaviour(AbstractRoundBehaviour): RedeemBehaviour, # type: ignore HandleFailedTxBehaviour, # type: ignore ToolSelectionBehaviour, # type: ignore + OrderSubscriptionBehaviour, + ClaimSubscriptionBehaviour, } diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index 0efbe76c8..eec9bfc34 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -19,9 +19,9 @@ fingerprint: behaviours/decision_receive.py: bafybeidvae35fzdmf2hvn3lqkc67zgjy5enu3vi3z5duomlqmf2v4zvxza behaviours/decision_request.py: bafybeidhmhjxt5xjhznxchqqqh6ohdssyyyzuqxv6dfdvpza7c2bxigajq behaviours/handle_failed_tx.py: bafybeidxpc6u575ymct5tdwutvzov6zqfdoio5irgldn3fw7q3lg36mmxm - behaviours/order_subscription.py: bafybeibjxiammauydlmnrkqu2hyw74v3ftxnb476kimcrqzfwmr65hijlq + behaviours/order_subscription.py: bafybeiemehj3srtzs5nxpnmaes6mqtgw6vreh2kpiwni2443qh6j2b4qlq behaviours/reedem.py: bafybeibenzbek5qdtk3gobjxfmsm6tg6i3d4yltozymy23izpgbcpal5ye - behaviours/round_behaviour.py: bafybeig4tdktyu6hapoqymnxh2bgpds547st6a44heue657wkctwe4gjvm + behaviours/round_behaviour.py: bafybeifgx6x6ykdkxgsarjkua6pq4vwrbanit3gcwc3wwij6bwfk7yi7ta behaviours/sampling.py: bafybeifzhm4sspdvt227ksl5hjn26offgqpwempgbcwbr6dq7gyi2a46sm behaviours/tool_selection.py: bafybeifpvrrbftlkjsoiysnasihzttousk6hxnukzrln6z2d33e3zexkje dialogues.py: bafybeigpwuzku3we7axmxeamg7vn656maww6emuztau5pg3ebsoquyfdqm @@ -56,7 +56,7 @@ fingerprint: fingerprint_ignore_patterns: [] connections: [] contracts: -- valory/gnosis_safe:0.1.0:bafybeiegkl6zrbvlbpwmoziw4hfkocjfqdqphkmpgow7ovsmv7bwa3f4pe +- valory/gnosis_safe:0.1.0:bafybeic54u6jwqicav2xtkm6kfb3udjvxzufch5z3vwoloe72a7sjlhgua - valory/market_maker:0.1.0:bafybeihcueo3ct3h5fqyrwsjeofr5winyxlnegnwdvofopwhrfzkhgpxte - valory/erc20:0.1.0:bafybeiecuaahlywb2rw6s76av5rdqg4gad6j753to6aqrix7zmbbt6kj6q - valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y @@ -70,9 +70,9 @@ protocols: - valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru - valory/ipfs:0.1.0:bafybeiedxeismnx3k5ty4mvvhlqideixlhqmi5mtcki4lxqfa7uqh7p33u skills: -- valory/abstract_round_abci:0.1.0:bafybeicrzndcdbue34yxwwb4hmmdhgzw4owcdcdag3ifj6thpx5wie3dp4 -- valory/market_manager_abci:0.1.0:bafybeietn6vjbxbqvkf4rxodm3feh4ayaliltlxofnb5tiie5yo3cbspiq -- valory/transaction_settlement_abci:0.1.0:bafybeifpnkwgwpzz6uwrvfgurm26allr6shjfbp7bfbrxwy64sw3nf3fsa +- valory/abstract_round_abci:0.1.0:bafybeidbmd2cgffqqfwsyxws5dffsc6nbt5ijgkbhyzse5i42yddmwqlpy +- valory/market_manager_abci:0.1.0:bafybeicqjiqq63bcb6colaq4adwsn7o6zhyd7n5ftwdv4kvt3rqxhnapw4 +- valory/transaction_settlement_abci:0.1.0:bafybeidsfwslnbhhhplvgteeec7idrhm7gxpay4f36wwnkgl4mh7ogovke behaviours: main: args: {} diff --git a/packages/valory/skills/market_manager_abci/skill.yaml b/packages/valory/skills/market_manager_abci/skill.yaml index a9fd360c0..6abac78ff 100644 --- a/packages/valory/skills/market_manager_abci/skill.yaml +++ b/packages/valory/skills/market_manager_abci/skill.yaml @@ -30,7 +30,7 @@ connections: [] contracts: [] protocols: [] skills: -- valory/abstract_round_abci:0.1.0:bafybeicrzndcdbue34yxwwb4hmmdhgzw4owcdcdag3ifj6thpx5wie3dp4 +- valory/abstract_round_abci:0.1.0:bafybeidbmd2cgffqqfwsyxws5dffsc6nbt5ijgkbhyzse5i42yddmwqlpy behaviours: main: args: {} diff --git a/packages/valory/skills/staking_abci/skill.yaml b/packages/valory/skills/staking_abci/skill.yaml index a80932e8c..f75a7a90b 100644 --- a/packages/valory/skills/staking_abci/skill.yaml +++ b/packages/valory/skills/staking_abci/skill.yaml @@ -18,13 +18,13 @@ fingerprint: fingerprint_ignore_patterns: [] connections: [] contracts: -- valory/gnosis_safe:0.1.0:bafybeiegkl6zrbvlbpwmoziw4hfkocjfqdqphkmpgow7ovsmv7bwa3f4pe +- valory/gnosis_safe:0.1.0:bafybeic54u6jwqicav2xtkm6kfb3udjvxzufch5z3vwoloe72a7sjlhgua - valory/service_staking_token:0.1.0:bafybeidhtmaaktcmg5j64e4btca4ngb67w7wjsecn55xcdcd6qmdg66ty4 protocols: - valory/contract_api:1.0.0:bafybeialhbjvwiwcnqq3ysxcyemobcbie7xza66gaofcvla5njezkvhcka skills: -- valory/abstract_round_abci:0.1.0:bafybeicrzndcdbue34yxwwb4hmmdhgzw4owcdcdag3ifj6thpx5wie3dp4 -- valory/transaction_settlement_abci:0.1.0:bafybeifpnkwgwpzz6uwrvfgurm26allr6shjfbp7bfbrxwy64sw3nf3fsa +- valory/abstract_round_abci:0.1.0:bafybeidbmd2cgffqqfwsyxws5dffsc6nbt5ijgkbhyzse5i42yddmwqlpy +- valory/transaction_settlement_abci:0.1.0:bafybeidsfwslnbhhhplvgteeec7idrhm7gxpay4f36wwnkgl4mh7ogovke behaviours: main: args: {} diff --git a/packages/valory/skills/trader_abci/composition.py b/packages/valory/skills/trader_abci/composition.py index 9a483e85c..d6afd48a8 100644 --- a/packages/valory/skills/trader_abci/composition.py +++ b/packages/valory/skills/trader_abci/composition.py @@ -32,7 +32,7 @@ FinishedDecisionMakerRound, FinishedWithoutDecisionRound, FinishedWithoutRedeemingRound, - RefillRequiredRound, + RefillRequiredRound, FinishedSubscriptionRound, ) from packages.valory.skills.decision_maker_abci.states.handle_failed_tx import ( HandleFailedTxRound, @@ -96,6 +96,7 @@ FinishedTransactionSubmissionRound: PostTxSettlementRound, FailedTransactionSubmissionRound: HandleFailedTxRound, FinishedDecisionRequestTxRound: DecisionReceiveRound, + FinishedSubscriptionRound: PreTxSettlementRound, FinishedBetPlacementTxRound: RedeemRound, FinishedRedeemingTxRound: CallCheckpointRound, FinishedWithoutDecisionRound: RedeemRound, diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index 9c9a6f042..d277e845c 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -9,7 +9,7 @@ fingerprint: README.md: bafybeiab4xgadptz4mhvno4p6xvkh7p4peg7iuhotabydriu74dmj6ljga __init__.py: bafybeido7wa33h4dtleap57vzgyb4fsofk4vindsqcekyfo5i56i2rll2a behaviours.py: bafybeieesrefrpo5c5upzztgm5fwfrmxeagilacuau5nacobhsfvgpbzby - composition.py: bafybeiajga2m7pv7v4bxsjsnncavdns6gujg7qg7opfjyznlzip3gbd3nm + composition.py: bafybeifr56wvckvyo5sz2rglnr4yhezwe2p6p4aifx7dokmuhz7vhrdkuu dialogues.py: bafybeiebofyykseqp3fmif36cqmmyf3k7d2zbocpl6t6wnlpv4szghrxbm fsm_specification.yaml: bafybeib3ycl5bjo5uilyaly7uoovvc3b3gpjrkuvdos5ffsgmrs73j6bkm handlers.py: bafybeibkiqwe7hoqccjirimd44nzeqkabc7oo74romqklssion27s5sa2a @@ -19,15 +19,15 @@ connections: [] contracts: [] protocols: [] skills: -- valory/abstract_round_abci:0.1.0:bafybeicrzndcdbue34yxwwb4hmmdhgzw4owcdcdag3ifj6thpx5wie3dp4 -- valory/registration_abci:0.1.0:bafybeihjlapvviakobxg7aa5qubgqoz6xurlhu7xxtnrg5ah3ag2qj626i -- valory/reset_pause_abci:0.1.0:bafybeibnwjcjx4lluf4cwb6es5peelu3gm7vrzlieygrzpbjlubxpvbvzy -- valory/transaction_settlement_abci:0.1.0:bafybeifpnkwgwpzz6uwrvfgurm26allr6shjfbp7bfbrxwy64sw3nf3fsa -- valory/termination_abci:0.1.0:bafybeifdtxgldw33kwvsavcituzewwbr6iqfcsgk5qouqfhpwdrivyyyom -- valory/market_manager_abci:0.1.0:bafybeietn6vjbxbqvkf4rxodm3feh4ayaliltlxofnb5tiie5yo3cbspiq -- valory/decision_maker_abci:0.1.0:bafybeic25tlxaqalnyy4yj6bisa7ev7g34lazzrvis5yhet52biwp5cp2a -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeig3u6zpilnariioqh26bg3pw5pfjagfgg7qox7c7rjtatlabv27ti -- valory/staking_abci:0.1.0:bafybeielt3ion6leloaj7anom4dmss3wp4exz4y3kwkx5sqj2rbxd6lsiy +- valory/abstract_round_abci:0.1.0:bafybeidbmd2cgffqqfwsyxws5dffsc6nbt5ijgkbhyzse5i42yddmwqlpy +- valory/registration_abci:0.1.0:bafybeieylbkzk3zju6un3xysextycnj72aniq2britpvnniud4ekglcbbi +- valory/reset_pause_abci:0.1.0:bafybeida6w2afp4m3dvnbkbwxz67ozjlry3wpsbkxwz7usalm3o2ghy46u +- valory/transaction_settlement_abci:0.1.0:bafybeidsfwslnbhhhplvgteeec7idrhm7gxpay4f36wwnkgl4mh7ogovke +- valory/termination_abci:0.1.0:bafybeid5ipudhwuiuhbzvpn4usgdm3a3ow3naafuefvetmgbbcy6ugyuwi +- valory/market_manager_abci:0.1.0:bafybeicqjiqq63bcb6colaq4adwsn7o6zhyd7n5ftwdv4kvt3rqxhnapw4 +- valory/decision_maker_abci:0.1.0:bafybeih72hy7st6muq6ojfawtmrndafwkq4v36mp3cula23tt255yus2je +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeighevqttuxh2zy5eux6ff24clan2het472th57mjub2onn6qq3oe4 +- valory/staking_abci:0.1.0:bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u behaviours: main: args: {} diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index 832166c0d..19d7035a1 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -20,9 +20,9 @@ contracts: [] protocols: - valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru skills: -- valory/abstract_round_abci:0.1.0:bafybeicrzndcdbue34yxwwb4hmmdhgzw4owcdcdag3ifj6thpx5wie3dp4 -- valory/decision_maker_abci:0.1.0:bafybeic25tlxaqalnyy4yj6bisa7ev7g34lazzrvis5yhet52biwp5cp2a -- valory/staking_abci:0.1.0:bafybeielt3ion6leloaj7anom4dmss3wp4exz4y3kwkx5sqj2rbxd6lsiy +- valory/abstract_round_abci:0.1.0:bafybeidbmd2cgffqqfwsyxws5dffsc6nbt5ijgkbhyzse5i42yddmwqlpy +- valory/decision_maker_abci:0.1.0:bafybeih72hy7st6muq6ojfawtmrndafwkq4v36mp3cula23tt255yus2je +- valory/staking_abci:0.1.0:bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u behaviours: main: args: {} From c6d98594190cafd0e767816c4953c544ede10341 Mon Sep 17 00:00:00 2001 From: Ardian Date: Fri, 19 Jan 2024 12:14:10 +0100 Subject: [PATCH 06/12] feat: add misc changes for nevermined --- packages/packages.json | 12 +- packages/valory/agents/trader/aea-config.yaml | 7 +- .../transfer_nft_condition/contract.yaml | 2 +- packages/valory/services/trader/service.yaml | 2 +- .../decision_maker_abci/behaviours/base.py | 25 +- .../behaviours/claim_subscription.py | 19 +- .../behaviours/order_subscription.py | 105 ++++--- .../behaviours/round_behaviour.py | 8 +- .../skills/decision_maker_abci/models.py | 4 +- .../skills/decision_maker_abci/payloads.py | 2 +- .../skills/decision_maker_abci/rounds.py | 19 +- .../skills/decision_maker_abci/skill.yaml | 26 +- .../states/claim_subscription.py | 13 +- .../states/final_states.py | 1 + .../states/order_subscription.py | 27 +- .../decision_maker_abci/utils/__init__.py | 1 - .../decision_maker_abci/utils/nevermined.py | 293 ++++++++++++------ .../valory/skills/trader_abci/composition.py | 8 +- packages/valory/skills/trader_abci/skill.yaml | 27 +- .../tx_settlement_multiplexer_abci/rounds.py | 13 + .../tx_settlement_multiplexer_abci/skill.yaml | 2 +- tox.ini | 4 + 22 files changed, 418 insertions(+), 202 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index 695061e78..6e5f71736 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -1,13 +1,13 @@ { "dev": { "skill/valory/market_manager_abci/0.1.0": "bafybeicqjiqq63bcb6colaq4adwsn7o6zhyd7n5ftwdv4kvt3rqxhnapw4", - "skill/valory/decision_maker_abci/0.1.0": "bafybeih72hy7st6muq6ojfawtmrndafwkq4v36mp3cula23tt255yus2je", - "skill/valory/trader_abci/0.1.0": "bafybeibm6uqtpwyiya3hirg2rqyfkm7ma5mx5zi52ilqgbwmd6zcpvfxmu", + "skill/valory/decision_maker_abci/0.1.0": "bafybeifyqwmodmic6if4rjj3v5g5pehzwl7bjir2heoqbm5gsdmp3pdoey", + "skill/valory/trader_abci/0.1.0": "bafybeifrb2kr6y5h3qcuayqggfptgdapmyqj5iabthkcaw3zgjicbkqp4u", "contract/valory/market_maker/0.1.0": "bafybeihcueo3ct3h5fqyrwsjeofr5winyxlnegnwdvofopwhrfzkhgpxte", - "agent/valory/trader/0.1.0": "bafybeihn546kbsi4o5jkvgl7ngpjcfjhapquhur22zruewxsni3o7hfivy", - "service/valory/trader/0.1.0": "bafybeievbiavkfiv2ekfxpn6pmu55az75igjl2o7rz2alhrg6iah4pkt2a", + "agent/valory/trader/0.1.0": "bafybeiadeayrkx6errhyeikaj2gj6jsij3jf5wrkzbyjp3pn5ik4eeufta", + "service/valory/trader/0.1.0": "bafybeifwssmq7r2pzbqjfouj3hwmyzk7d2wuni566tqnj3uwtz6zd5mi64", "contract/valory/erc20/0.1.0": "bafybeiecuaahlywb2rw6s76av5rdqg4gad6j753to6aqrix7zmbbt6kj6q", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeighevqttuxh2zy5eux6ff24clan2het472th57mjub2onn6qq3oe4", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeidtxu67k3p5hv7zxgc72nw72h7nrum3sl3bk33bokepgcw224tjb4", "contract/valory/mech/0.1.0": "bafybeigmkbovcb6wcfqkkmmryo6kzqsai5qq325lzmsvtlxe4fn6rcmwoy", "contract/valory/realitio/0.1.0": "bafybeic5ie4oodetj4krdogydvbfxg4qggc3matpiflocah626tpevpreq", "contract/valory/realitio_proxy/0.1.0": "bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4", @@ -15,7 +15,7 @@ "contract/valory/agent_registry/0.1.0": "bafybeib5czj6b3q6cukykbddo2nmn7etgmle53erq7ucapz5o7dzunno4a", "contract/valory/service_staking_token/0.1.0": "bafybeidhtmaaktcmg5j64e4btca4ngb67w7wjsecn55xcdcd6qmdg66ty4", "skill/valory/staking_abci/0.1.0": "bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u", - "contract/valory/transfer_nft_condition/0.1.0": "bafybeibl4xi2we6fpolemdroaoz4rka7ck3pcff5blyag3cq2kdxnd7iyq" + "contract/valory/transfer_nft_condition/0.1.0": "bafybeiava25cadkt3p42gbjpdcvdeoyb4doyrfhbfipldzwyl6hrjuwc3e" }, "third_party": { "protocol/open_aea/signing/1.0.0": "bafybeie7xyems76v5b4wc2lmaidcujizpxfzjnnwdeokmhje53g7ym25ii", diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index 99193ee27..535eb7c43 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -27,6 +27,7 @@ contracts: - valory/realitio_proxy:0.1.0:bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4 - valory/agent_registry:0.1.0:bafybeib5czj6b3q6cukykbddo2nmn7etgmle53erq7ucapz5o7dzunno4a - valory/service_staking_token:0.1.0:bafybeidhtmaaktcmg5j64e4btca4ngb67w7wjsecn55xcdcd6qmdg66ty4 +- valory/transfer_nft_condition:0.1.0:bafybeiava25cadkt3p42gbjpdcvdeoyb4doyrfhbfipldzwyl6hrjuwc3e protocols: - open_aea/signing:1.0.0:bafybeie7xyems76v5b4wc2lmaidcujizpxfzjnnwdeokmhje53g7ym25ii - valory/abci:0.1.0:bafybeihmzlmmb4pdo3zkhg6ehuyaa4lhw7bfpclln2o2z7v3o6fcep26iu @@ -43,10 +44,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeida6w2afp4m3dvnbkbwxz67ozjlry3wpsbkxwz7usalm3o2ghy46u - valory/termination_abci:0.1.0:bafybeid5ipudhwuiuhbzvpn4usgdm3a3ow3naafuefvetmgbbcy6ugyuwi - valory/transaction_settlement_abci:0.1.0:bafybeidsfwslnbhhhplvgteeec7idrhm7gxpay4f36wwnkgl4mh7ogovke -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeighevqttuxh2zy5eux6ff24clan2het472th57mjub2onn6qq3oe4 +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeidtxu67k3p5hv7zxgc72nw72h7nrum3sl3bk33bokepgcw224tjb4 - valory/market_manager_abci:0.1.0:bafybeicqjiqq63bcb6colaq4adwsn7o6zhyd7n5ftwdv4kvt3rqxhnapw4 -- valory/decision_maker_abci:0.1.0:bafybeih72hy7st6muq6ojfawtmrndafwkq4v36mp3cula23tt255yus2je -- valory/trader_abci:0.1.0:bafybeibm6uqtpwyiya3hirg2rqyfkm7ma5mx5zi52ilqgbwmd6zcpvfxmu +- valory/decision_maker_abci:0.1.0:bafybeifyqwmodmic6if4rjj3v5g5pehzwl7bjir2heoqbm5gsdmp3pdoey +- valory/trader_abci:0.1.0:bafybeifrb2kr6y5h3qcuayqggfptgdapmyqj5iabthkcaw3zgjicbkqp4u - valory/staking_abci:0.1.0:bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u default_ledger: ethereum required_ledgers: diff --git a/packages/valory/contracts/transfer_nft_condition/contract.yaml b/packages/valory/contracts/transfer_nft_condition/contract.yaml index f3c3d506a..0f8663369 100644 --- a/packages/valory/contracts/transfer_nft_condition/contract.yaml +++ b/packages/valory/contracts/transfer_nft_condition/contract.yaml @@ -8,7 +8,7 @@ aea_version: '>=1.0.0, <2.0.0' fingerprint: README.md: bafybeidiaep6cpoqlabnajvsgegpt72hqnbtozayicaxclzxzftopvlw5u __init__.py: bafybeigr6fpkchrud5tjrx5qevyk436jufe4zt6otkpbzsiergvyp64hs4 - build/TransferNFTCondition.json: bafybeihjasxvef6utvcdboz2jmjlyldxaqjsakynpzxgfwzczcesoys22m + build/TransferNFTCondition.json: bafybeigozlmtk3d3fggn5a2faiteqjujrkbgkvi54ee2jr4snse4nd3s2u contract.py: bafybeihz5jeggunv4owoamcpgohs7qgnfjqicuxk3zv4hwbxzysnto3w7q fingerprint_ignore_patterns: [] contracts: [] diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index 1419d406b..ac9dcafc8 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeihn546kbsi4o5jkvgl7ngpjcfjhapquhur22zruewxsni3o7hfivy +agent: valory/trader:0.1.0:bafybeiadeayrkx6errhyeikaj2gj6jsij3jf5wrkzbyjp3pn5ik4eeufta number_of_agents: 4 deployment: {} --- diff --git a/packages/valory/skills/decision_maker_abci/behaviours/base.py b/packages/valory/skills/decision_maker_abci/behaviours/base.py index bf93649b1..bd497e6af 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/base.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/base.py @@ -554,11 +554,12 @@ def finish_behaviour(self, payload: BaseTxPayload) -> Generator: class BaseSubscriptionBehaviour(DecisionMakerBaseBehaviour, ABC): + """Base class for subscription behaviours.""" + @property def subscription_params(self) -> Dict[str, Any]: """Get the subscription params.""" - mech = self.params.mech_agent_address - return self.params.mech_to_subscription_params[mech] + return self.params.mech_to_subscription_params @property def did(self) -> str: @@ -588,19 +589,31 @@ def transfer_nft_condition_address(self) -> str: def token_address(self) -> str: """Get the token address.""" subscription_params = self.subscription_params - return subscription_params["token"] + return subscription_params["token_address"] + + @property + def order_address(self) -> str: + """Get the order address.""" + subscription_params = self.subscription_params + return subscription_params["order_address"] @property def purchase_amount(self) -> int: """Get the purchase amount.""" subscription_params = self.subscription_params - return subscription_params["nft_amount"] + return int(subscription_params["nft_amount"]) @property def price(self) -> int: """Get the price.""" subscription_params = self.subscription_params - return subscription_params["price"] + return int(subscription_params["price"]) + + @property + def payment_token(self) -> str: + """Get the payment token.""" + subscription_params = self.subscription_params + return subscription_params["payment_token"] @property def base_url(self) -> str: @@ -623,7 +636,7 @@ def _resolve_did(self) -> Generator[None, None, Optional[Dict[str, Any]]]: ) return None try: - data = json.loads(response.body)["data"] + data = json.loads(response.body) except (ValueError, TypeError) as e: self.context.logger.error( f"Could not parse response from nervermined api, " diff --git a/packages/valory/skills/decision_maker_abci/behaviours/claim_subscription.py b/packages/valory/skills/decision_maker_abci/behaviours/claim_subscription.py index 329602c8c..049e8edb3 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/claim_subscription.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/claim_subscription.py @@ -21,13 +21,18 @@ import json from typing import Any, Generator - from packages.valory.skills.decision_maker_abci.behaviours.base import ( BaseSubscriptionBehaviour, ) from packages.valory.skills.decision_maker_abci.payloads import ClaimPayload -from packages.valory.skills.decision_maker_abci.states.claim_subscription import ClaimRound -from packages.valory.skills.decision_maker_abci.utils.nevermined import get_creator, get_claim_endpoint +from packages.valory.skills.decision_maker_abci.states.claim_subscription import ( + ClaimRound, +) +from packages.valory.skills.decision_maker_abci.utils.nevermined import ( + get_claim_endpoint, + get_creator, +) + SERVICE_INDEX = -1 ERC1155 = 1155 @@ -63,14 +68,14 @@ def _claim_subscription(self) -> Generator[None, None, bool]: "serviceIndex": SERVICE_INDEX, } res = yield from self.get_http_response( - 'POST', + "POST", claim_endpoint, json.dumps(body).encode(), - headers={'Content-Type': 'application/json'}, + headers={"Content-Type": "application/json"}, ) - if res.status_code != 200: + if res.status_code != 201: self.context.logger.warning( - f'Failed to claim subscription: {res.status_code} - {res.body}', + f"Failed to claim subscription: {res.status_code!r} - {res.body!r}", ) return False diff --git a/packages/valory/skills/decision_maker_abci/behaviours/order_subscription.py b/packages/valory/skills/decision_maker_abci/behaviours/order_subscription.py index 9157717cf..881f14746 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/order_subscription.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/order_subscription.py @@ -18,27 +18,37 @@ # ------------------------------------------------------------------------------ """This module contains the behaviour for the decision-making of the skill.""" -import json -from typing import Any, Generator, Optional, Dict, List +from typing import Any, Dict, Generator, List, Optional, cast from hexbytes import HexBytes from packages.valory.contracts.erc20.contract import ERC20 -from packages.valory.contracts.transfer_nft_condition.contract import TransferNftCondition +from packages.valory.contracts.transfer_nft_condition.contract import ( + TransferNftCondition, +) from packages.valory.protocols.contract_api import ContractApiMessage from packages.valory.skills.decision_maker_abci.behaviours.base import ( - DecisionMakerBaseBehaviour, BaseSubscriptionBehaviour, + BaseSubscriptionBehaviour, ) from packages.valory.skills.decision_maker_abci.models import MultisendBatch -from packages.valory.skills.decision_maker_abci.payloads import DecisionReceivePayload, SubscriptionPayload -from packages.valory.skills.decision_maker_abci.states.order_subscription import SubscriptionRound -from packages.valory.skills.decision_maker_abci.utils.nevermined import generate_id, zero_x_transformer, \ - no_did_prefixed, get_lock_payment_seed, get_price, get_transfer_nft_condition_seed, get_escrow_payment_seed, \ - get_timeouts_and_timelocks, get_reward_address - +from packages.valory.skills.decision_maker_abci.payloads import SubscriptionPayload +from packages.valory.skills.decision_maker_abci.states.order_subscription import ( + SubscriptionRound, +) +from packages.valory.skills.decision_maker_abci.utils.nevermined import ( + generate_id, + get_agreement_id, + get_escrow_payment_seed, + get_lock_payment_seed, + get_price, + get_timeouts_and_timelocks, + get_transfer_nft_condition_seed, + no_did_prefixed, + zero_x_transformer, +) -LOCK_CONDITION_INDEX = 1 +LOCK_CONDITION_INDEX = 0 class OrderSubscriptionBehaviour(BaseSubscriptionBehaviour): @@ -54,34 +64,47 @@ def __init__(self, **kwargs: Any) -> None: self.balance: int = 0 self.agreement_id: str = "" - def _get_condition_ids(self, did_doc: Dict[str, Any]) -> List[str]: + def _get_condition_ids( + self, agreement_id_seed: str, did_doc: Dict[str, Any] + ) -> List[str]: """Get the condition ids.""" + self.agreement_id = get_agreement_id( + agreement_id_seed, self.synchronized_data.safe_contract_address + ) price = get_price(did_doc) receivers = list(price.keys()) amounts = list(price.values()) - lock_payment_seed = get_lock_payment_seed( + lock_payment_seed, lock_payment_id = get_lock_payment_seed( + self.agreement_id, did_doc, + self.lock_payment_condition_address, self.escrow_payment_condition_address, - self.token_address, + self.payment_token, amounts, receivers, ) - transfer_nft_condition_seed = get_transfer_nft_condition_seed( + ( + transfer_nft_condition_seed, + transfer_nft_condition_id, + ) = get_transfer_nft_condition_seed( + self.agreement_id, did_doc, - self.transfer_nft_condition_address, + self.synchronized_data.safe_contract_address, self.purchase_amount, - lock_payment_seed, + self.transfer_nft_condition_address, + lock_payment_id, self.token_address, ) - escrow_payment_seed = get_escrow_payment_seed( + escrow_payment_seed, _ = get_escrow_payment_seed( + self.agreement_id, did_doc, amounts, receivers, self.synchronized_data.safe_contract_address, self.escrow_payment_condition_address, - self.token_address, - lock_payment_seed, - transfer_nft_condition_seed, + self.payment_token, + lock_payment_id, + transfer_nft_condition_id, ) condition_ids = [ lock_payment_seed, @@ -90,7 +113,6 @@ def _get_condition_ids(self, did_doc: Dict[str, Any]) -> List[str]: ] return condition_ids - def _get_purchase_params(self) -> Generator[None, None, Optional[Dict[str, Any]]]: """Get purchase params.""" agreement_id = zero_x_transformer(generate_id()) @@ -99,9 +121,8 @@ def _get_purchase_params(self) -> Generator[None, None, Optional[Dict[str, Any]] if did_doc is None: # something went wrong return None - condition_ids = self._get_condition_ids(did_doc) + condition_ids = self._get_condition_ids(agreement_id, did_doc) timeouts, timelocks = get_timeouts_and_timelocks(did_doc) - reward_address = get_reward_address(did_doc) price = get_price(did_doc) receivers = list(price.keys()) amounts = list(price.values()) @@ -112,20 +133,21 @@ def _get_purchase_params(self) -> Generator[None, None, Optional[Dict[str, Any]] "condition_ids": condition_ids, "consumer": self.synchronized_data.safe_contract_address, "index": LOCK_CONDITION_INDEX, - "timeouts": timeouts, - "timelocks": timelocks, - "reward_address": reward_address, + "time_outs": timeouts, + "time_locks": timelocks, + "reward_address": self.escrow_payment_condition_address, "receivers": receivers, "amounts": amounts, + "contract_address": self.order_address, + "token_address": self.payment_token, } def _get_approval_params(self) -> Dict[str, Any]: """Get approval params.""" - # TODO: get these from the did doc approval_params = {} - approval_params["token"] = self.token_address - approval_params["spender"] = self.transfer_nft_condition_address - approval_params["amount"] = self.price + approval_params["token"] = self.payment_token + approval_params["spender"] = self.lock_payment_condition_address + approval_params["amount"] = self.price # type: ignore return approval_params def _prepare_order_tx( @@ -141,7 +163,7 @@ def _prepare_order_tx( reward_address: str, token_address: str, amounts: List[int], - receives: List[str], + receivers: List[str], ) -> Generator[None, None, bool]: """Prepare a purchase tx.""" result = yield from self.contract_interact( @@ -161,7 +183,7 @@ def _prepare_order_tx( reward_address=reward_address, token_address=token_address, amounts=amounts, - receives=receives, + receives=receivers, ) if not result: return False @@ -172,8 +194,11 @@ def _prepare_order_tx( data=HexBytes(self.order_tx), ) ) + return True - def _prepare_approval_tx(self, token: str, spender: str, amount: int) -> Generator[None, None, bool]: + def _prepare_approval_tx( + self, token: str, spender: str, amount: int + ) -> Generator[None, None, bool]: """Prepare an approval tx.""" result = yield from self.contract_interact( performative=ContractApiMessage.Performative.GET_RAW_TRANSACTION, # type: ignore @@ -194,6 +219,8 @@ def _prepare_approval_tx(self, token: str, spender: str, amount: int) -> Generat data=HexBytes(self.approval_tx), ) ) + return True + def _get_balance(self, token: str, address: str) -> Generator[None, None, bool]: """Prepare an approval tx.""" result = yield from self.contract_interact( @@ -207,11 +234,13 @@ def _get_balance(self, token: str, address: str) -> Generator[None, None, bool]: ) if not result: return False - + return True def _should_purchase(self) -> Generator[None, None, bool]: """Check if the subscription should be purchased.""" - result = yield from self._get_balance(self.token_address, self.synchronized_data.safe_contract_address) + result = yield from self._get_balance( + self.token_address, self.synchronized_data.safe_contract_address + ) if not result: self.context.logger.warning("Failed to get balance") return False @@ -228,8 +257,6 @@ def get_payload_content(self) -> Generator[None, None, str]: if not result: return SubscriptionRound.ERROR_PAYLOAD - self.agreement_id = approval_params["agreement_id"] - purchase_params = yield from self._get_purchase_params() if purchase_params is None: return SubscriptionRound.ERROR_PAYLOAD @@ -244,7 +271,7 @@ def get_payload_content(self) -> Generator[None, None, str]: ): yield from self.wait_for_condition_with_sleep(build_step) - return self.safe_tx_hash + return cast(str, self.tx_hex) def async_act(self) -> Generator: """Do the action.""" diff --git a/packages/valory/skills/decision_maker_abci/behaviours/round_behaviour.py b/packages/valory/skills/decision_maker_abci/behaviours/round_behaviour.py index bad7e151d..d8faca160 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/round_behaviour.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/round_behaviour.py @@ -31,7 +31,9 @@ from packages.valory.skills.decision_maker_abci.behaviours.blacklisting import ( BlacklistingBehaviour, ) -from packages.valory.skills.decision_maker_abci.behaviours.claim_subscription import ClaimSubscriptionBehaviour +from packages.valory.skills.decision_maker_abci.behaviours.claim_subscription import ( + ClaimSubscriptionBehaviour, +) from packages.valory.skills.decision_maker_abci.behaviours.decision_receive import ( DecisionReceiveBehaviour, ) @@ -41,7 +43,9 @@ from packages.valory.skills.decision_maker_abci.behaviours.handle_failed_tx import ( HandleFailedTxBehaviour, ) -from packages.valory.skills.decision_maker_abci.behaviours.order_subscription import OrderSubscriptionBehaviour +from packages.valory.skills.decision_maker_abci.behaviours.order_subscription import ( + OrderSubscriptionBehaviour, +) from packages.valory.skills.decision_maker_abci.behaviours.reedem import RedeemBehaviour from packages.valory.skills.decision_maker_abci.behaviours.sampling import ( SamplingBehaviour, diff --git a/packages/valory/skills/decision_maker_abci/models.py b/packages/valory/skills/decision_maker_abci/models.py index 091cae9ec..bd3e24178 100644 --- a/packages/valory/skills/decision_maker_abci/models.py +++ b/packages/valory/skills/decision_maker_abci/models.py @@ -320,7 +320,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: kwargs, bool, ) - self.mech_to_subscription_params: Dict[str, Dict[str, Any]] = nested_list_todict_workaround( + self.mech_to_subscription_params: Dict[ + str, Any + ] = nested_list_todict_workaround( kwargs, "mech_to_subscription_params", ) diff --git a/packages/valory/skills/decision_maker_abci/payloads.py b/packages/valory/skills/decision_maker_abci/payloads.py index 4f169ee8c..08a9908cd 100644 --- a/packages/valory/skills/decision_maker_abci/payloads.py +++ b/packages/valory/skills/decision_maker_abci/payloads.py @@ -72,7 +72,7 @@ class RequestPayload(MultisigTxPayload): class SubscriptionPayload(MultisigTxPayload): """Represents a transaction payload for subscribing.""" - agreement_id: str = '' + agreement_id: str = "" @dataclass(frozen=True) diff --git a/packages/valory/skills/decision_maker_abci/rounds.py b/packages/valory/skills/decision_maker_abci/rounds.py index 8a627b1af..7bbe92189 100644 --- a/packages/valory/skills/decision_maker_abci/rounds.py +++ b/packages/valory/skills/decision_maker_abci/rounds.py @@ -37,7 +37,9 @@ from packages.valory.skills.decision_maker_abci.states.blacklisting import ( BlacklistingRound, ) -from packages.valory.skills.decision_maker_abci.states.claim_subscription import ClaimRound +from packages.valory.skills.decision_maker_abci.states.claim_subscription import ( + ClaimRound, +) from packages.valory.skills.decision_maker_abci.states.decision_receive import ( DecisionReceiveRound, ) @@ -46,15 +48,18 @@ ) from packages.valory.skills.decision_maker_abci.states.final_states import ( FinishedDecisionMakerRound, + FinishedSubscriptionRound, FinishedWithoutDecisionRound, FinishedWithoutRedeemingRound, ImpossibleRound, - RefillRequiredRound, FinishedSubscriptionRound, + RefillRequiredRound, ) from packages.valory.skills.decision_maker_abci.states.handle_failed_tx import ( HandleFailedTxRound, ) -from packages.valory.skills.decision_maker_abci.states.order_subscription import SubscriptionRound +from packages.valory.skills.decision_maker_abci.states.order_subscription import ( + SubscriptionRound, +) from packages.valory.skills.decision_maker_abci.states.redeem import RedeemRound from packages.valory.skills.decision_maker_abci.states.sampling import SamplingRound from packages.valory.skills.decision_maker_abci.states.tool_selection import ( @@ -141,7 +146,7 @@ class DecisionMakerAbciApp(AbciApp[Event]): } transition_function: AbciAppTransitionFunction = { SamplingRound: { - Event.DONE: ToolSelectionRound, + Event.DONE: SubscriptionRound, Event.NONE: FinishedWithoutDecisionRound, Event.NO_MAJORITY: SamplingRound, Event.ROUND_TIMEOUT: SamplingRound, @@ -214,6 +219,7 @@ class DecisionMakerAbciApp(AbciApp[Event]): FinishedDecisionMakerRound: {}, FinishedWithoutDecisionRound: {}, FinishedWithoutRedeemingRound: {}, + FinishedSubscriptionRound: {}, RefillRequiredRound: {}, ImpossibleRound: {}, } @@ -240,6 +246,7 @@ class DecisionMakerAbciApp(AbciApp[Event]): } db_pre_conditions: Dict[AppState, Set[str]] = { RedeemRound: set(), + ClaimRound: set(), DecisionReceiveRound: { get_name(SynchronizedData.final_tx_hash), }, @@ -254,6 +261,10 @@ class DecisionMakerAbciApp(AbciApp[Event]): get_name(SynchronizedData.tx_submitter), get_name(SynchronizedData.most_voted_tx_hash), }, + FinishedSubscriptionRound: { + get_name(SynchronizedData.tx_submitter), + get_name(SynchronizedData.most_voted_tx_hash), + }, FinishedWithoutDecisionRound: {get_name(SynchronizedData.sampled_bet_index)}, FinishedWithoutRedeemingRound: set(), RefillRequiredRound: set(), diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index eec9bfc34..e6a78a70f 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -12,7 +12,7 @@ fingerprint: README.md: bafybeia367zzdwndvlhw27rvnwodytjo3ms7gbc3q7mhrrjqjgfasnk47i __init__.py: bafybeih563ujnigeci2ldzh7hakbau6a222vsed7leg3b7lq32vcn3nm4a behaviours/__init__.py: bafybeih6ddz2ocvm6x6ytvlbcz6oi4snb5ee5xh5h65nq4w2qf7fd7zfky - behaviours/base.py: bafybeif7fbndiwrd3azurflytki5e3rj5yvsydohdrqoslcd5ubpxkubyi + behaviours/base.py: bafybeib4kpmxv7svyvcb5ijp7ioohahfhjfsca7d4cijfijvs73g5nrsom behaviours/bet_placement.py: bafybeigtz4uimsqjjwq4r5p3a5v6niqdtqezbuf2ghy6o7syhsh4k5gjfa behaviours/blacklisting.py: bafybeierwdzn6vav54l6zym77hhx2vdx3jtnnwpbhwmwwyrqzncwjwkxu4 behaviours/claim_subscription.py: bafybeibied3wtszqohpbox4ztojjxtkbn3eg7rsp4qn2pgkqjgzjoz47qa @@ -65,6 +65,7 @@ contracts: - valory/realitio:0.1.0:bafybeic5ie4oodetj4krdogydvbfxg4qggc3matpiflocah626tpevpreq - valory/realitio_proxy:0.1.0:bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4 - valory/agent_registry:0.1.0:bafybeib5czj6b3q6cukykbddo2nmn7etgmle53erq7ucapz5o7dzunno4a +- valory/transfer_nft_condition:0.1.0:bafybeiava25cadkt3p42gbjpdcvdeoyb4doyrfhbfipldzwyl6hrjuwc3e protocols: - valory/contract_api:1.0.0:bafybeialhbjvwiwcnqq3ysxcyemobcbie7xza66gaofcvla5njezkvhcka - valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru @@ -198,6 +199,27 @@ models: slippage: 0.01 policy_epsilon: 0.1 use_subgraph_for_redeeming: true + mech_to_subscription_params: + - - base_url + - https://marketplace-api.gnosis.nevermined.app/api/v1/metadata/assets/ddo + - - did + - did:nv:416e35cb209ecbfbf23e1192557b06e94c5d9a9afb025cce2e9baff23e907195 + - - escrow_payment_condition_address + - '0x9dDC4F1Ea5b94C138A23b60EC48c0d01d172629a' + - - lock_payment_condition_address + - '0xDE85A368Ee6f374d236500d176814365370778dA' + - - transfer_nft_condition_address + - '0xbBa4A25262745a55f020D0a3E9a82c25bb6F4979' + - - token_address + - '0xa30DE8C6aC39B825192e5F1FADe0770332D279A8' + - - order_address + - '0xc7751eff5396a846e7bc83ac31d3cb7d37cb49e4' + - - payment_token + - '0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83' + - - nft_amount + - '1' + - - price + - '0' irrelevant_tools: - openai-text-davinci-002 - openai-text-davinci-003 @@ -313,6 +335,8 @@ dependencies: version: ==0.2.1 web3: version: <7,>=6.0.0 + eth-abi: + version: ==4.0.0 pyyaml: version: <=6.0.1,>=3.10 is_abstract: true diff --git a/packages/valory/skills/decision_maker_abci/states/claim_subscription.py b/packages/valory/skills/decision_maker_abci/states/claim_subscription.py index 7a9f76bf5..307b8f20c 100644 --- a/packages/valory/skills/decision_maker_abci/states/claim_subscription.py +++ b/packages/valory/skills/decision_maker_abci/states/claim_subscription.py @@ -19,18 +19,11 @@ """This module contains the decision receiving state of the decision-making abci app.""" -from enum import Enum -from typing import Optional, Tuple, cast, Type - -from packages.valory.skills.abstract_round_abci.base import ( - CollectSameUntilThresholdRound, - get_name, BaseSynchronizedData, VotingRound, -) -from packages.valory.skills.decision_maker_abci.payloads import DecisionReceivePayload, MultisigTxPayload, \ - SubscriptionPayload, ClaimPayload +from packages.valory.skills.abstract_round_abci.base import VotingRound, get_name +from packages.valory.skills.decision_maker_abci.payloads import ClaimPayload from packages.valory.skills.decision_maker_abci.states.base import ( Event, - SynchronizedData, TxPreparationRound, + SynchronizedData, ) diff --git a/packages/valory/skills/decision_maker_abci/states/final_states.py b/packages/valory/skills/decision_maker_abci/states/final_states.py index e2f213cb1..d105104a6 100644 --- a/packages/valory/skills/decision_maker_abci/states/final_states.py +++ b/packages/valory/skills/decision_maker_abci/states/final_states.py @@ -25,6 +25,7 @@ class FinishedDecisionMakerRound(DegenerateRound): """A round representing that decision-making has finished.""" + class FinishedSubscriptionRound(DegenerateRound): """A round representing that subscription has finished.""" diff --git a/packages/valory/skills/decision_maker_abci/states/order_subscription.py b/packages/valory/skills/decision_maker_abci/states/order_subscription.py index e442ec894..7d2c3798f 100644 --- a/packages/valory/skills/decision_maker_abci/states/order_subscription.py +++ b/packages/valory/skills/decision_maker_abci/states/order_subscription.py @@ -20,17 +20,20 @@ """This module contains the decision receiving state of the decision-making abci app.""" from enum import Enum -from typing import Optional, Tuple, cast, Type +from typing import Optional, Tuple, Type from packages.valory.skills.abstract_round_abci.base import ( - CollectSameUntilThresholdRound, - get_name, BaseSynchronizedData, + BaseSynchronizedData, + get_name, +) +from packages.valory.skills.decision_maker_abci.payloads import ( + MultisigTxPayload, + SubscriptionPayload, ) -from packages.valory.skills.decision_maker_abci.payloads import DecisionReceivePayload, MultisigTxPayload, \ - SubscriptionPayload from packages.valory.skills.decision_maker_abci.states.base import ( Event, - SynchronizedData, TxPreparationRound, + SynchronizedData, + TxPreparationRound, ) @@ -39,7 +42,7 @@ class SubscriptionRound(TxPreparationRound): payload_class: Type[MultisigTxPayload] = SubscriptionPayload selection_key = TxPreparationRound.selection_key + ( - get_name(SynchronizedData.mech_price), + get_name(SynchronizedData.agreement_id), ) none_event = Event.NO_SUBSCRIPTION @@ -49,11 +52,11 @@ class SubscriptionRound(TxPreparationRound): def end_block(self) -> Optional[Tuple[BaseSynchronizedData, Enum]]: """Process the end of the block.""" if self.threshold_reached: - payload = cast(SubscriptionPayload, self.most_voted_payload) - if payload.tx_hash == self.ERROR_PAYLOAD: + tx_hash = self.most_voted_payload_values[1] + if tx_hash == self.ERROR_PAYLOAD: return self.synchronized_data, Event.SUBSCRIPTION_ERROR - if payload.tx_hash == self.NO_TX_PAYLOAD: + if tx_hash == self.NO_TX_PAYLOAD: return self.synchronized_data, Event.NO_SUBSCRIPTION update = super().end_block() @@ -61,8 +64,8 @@ def end_block(self) -> Optional[Tuple[BaseSynchronizedData, Enum]]: return None sync_data, event = update - payload = cast(SubscriptionPayload, self.most_voted_payload) + agreement_id = self.most_voted_payload_values[2] sync_data = sync_data.update( - agreement_id=payload.agreement_id, + agreement_id=agreement_id, ) return sync_data, event diff --git a/packages/valory/skills/decision_maker_abci/utils/__init__.py b/packages/valory/skills/decision_maker_abci/utils/__init__.py index 316da2085..fc72e841a 100644 --- a/packages/valory/skills/decision_maker_abci/utils/__init__.py +++ b/packages/valory/skills/decision_maker_abci/utils/__init__.py @@ -17,4 +17,3 @@ # # ------------------------------------------------------------------------------ """This package contains helpers.""" - diff --git a/packages/valory/skills/decision_maker_abci/utils/nevermined.py b/packages/valory/skills/decision_maker_abci/utils/nevermined.py index c77dccfd1..aafe719fd 100644 --- a/packages/valory/skills/decision_maker_abci/utils/nevermined.py +++ b/packages/valory/skills/decision_maker_abci/utils/nevermined.py @@ -21,94 +21,139 @@ import re import uuid -from typing import Dict, Any, List, Tuple +from typing import Any, Dict, List, Tuple -import requests +from eth_abi import encode from web3 import Web3 def zero_x_transformer(input_str: str, zero_output: bool = True) -> str: """Transform a string to a hex string.""" - match = re.match(r'^(?:0x)*([a-f0-9]+)$', input_str, re.IGNORECASE) + match = re.match(r"^(?:0x)*([a-f0-9]+)$", input_str, re.IGNORECASE) valid = match is not None - output = match.group(1) if valid else '' + output = match.group(1) if valid else "" # type: ignore - return ('0x' if zero_output and valid else '') + output + return ("0x" if zero_output and valid else "") + output def generate_id(length: int = 64) -> str: """Generate a random ID.""" - generated_id = '' + generated_id = "" while len(generated_id) < length: - generated_id += str(uuid.uuid4()).replace('-', '') + generated_id += str(uuid.uuid4()).replace("-", "") return generated_id[:length] def find_service_by_type(did_doc: Dict[str, Any], type: str) -> Dict[str, Any]: """Find a service by name.""" - services = did_doc.get('service', []) + services = did_doc.get("service", []) for service in services: - if service.get('type') == type: + if service.get("type") == type: return service - raise Exception(f'No service found with type {type}') + raise Exception(f"No service found with type {type}") -def find_service_condition_by_name(service: Dict[str, Any], name: str) -> Dict[str, Any]: +def find_service_condition_by_name( + service: Dict[str, Any], name: str +) -> Dict[str, Any]: """Find a condition by name.""" - conditions = service.get('attributes', {}).get('serviceAgreementTemplate', {}).get('conditions', []) + conditions = ( + service.get("attributes", {}) + .get("serviceAgreementTemplate", {}) + .get("conditions", []) + ) - condition = next((c for c in conditions if c['name'] == name), None) + condition = next((c for c in conditions if c["name"] == name), None) if condition is None: - raise Exception(f"Condition '{name}' not found.") + raise Exception(f"Condition '{name!r}' not found.") return condition + def get_asset_price_from_service(service: Dict[str, Any]) -> Dict[str, int]: """Get the price of a DID.""" - escrow_payment_condition = find_service_condition_by_name(service, 'escrowPayment') + escrow_payment_condition = find_service_condition_by_name(service, "escrowPayment") if not escrow_payment_condition: - raise Exception('escrowPayment not found in service') - - amounts = next((p['value'] for p in escrow_payment_condition.get('parameters', []) if p['name'] == '_amounts'), []) - receivers = next((p['value'] for p in escrow_payment_condition.get('parameters', []) if p['name'] == '_receivers'), []) + raise Exception("escrowPayment not found in service") + + amounts: List = next( + ( + p["value"] + for p in escrow_payment_condition.get("parameters", []) + if p["name"] == "_amounts" + ), + [], + ) + receivers: List = next( + ( + p["value"] + for p in escrow_payment_condition.get("parameters", []) + if p["name"] == "_receivers" + ), + [], + ) rewards_map = dict(zip(receivers, map(int, amounts))) return rewards_map -def get_price(did_doc: Dict[str, Any], type: str = 'nft-sales') -> Dict[str, int]: + +def get_price(did_doc: Dict[str, Any], type: str = "nft-sales") -> Dict[str, int]: """Get the price of a DID.""" service = find_service_by_type(did_doc, type) return get_asset_price_from_service(service) -def get_nft_address(did_doc: Dict[str, Any], type: str = 'nft-sales') -> str: +def get_nft_address(did_doc: Dict[str, Any], type: str = "nft-sales") -> str: """Get the NFT address of a DID.""" service = find_service_by_type(did_doc, type) - transfer_condition = find_service_condition_by_name(service, 'transferNFT') - contract_param = next((p['value'] for p in transfer_condition.get('parameters', []) if p['name'] == '_contractAddress' or p['name'] == '_contract'), None) + transfer_condition = find_service_condition_by_name(service, "transferNFT") + contract_param = next( + ( + p["value"] + for p in transfer_condition.get("parameters", []) + if p["name"] == "_contractAddress" or p["name"] == "_contract" + ), + None, + ) + + return contract_param if contract_param is not None else "" - return contract_param if contract_param is not None else '' -def get_nft_holder(did_doc: Dict[str, Any], type: str = 'nft-sales') -> str: +def get_nft_holder(did_doc: Dict[str, Any], type: str = "nft-sales") -> str: """Get the NFT holder of a DID.""" service = find_service_by_type(did_doc, type) - transfer_condition = find_service_condition_by_name(service, 'transferNFT') - contract_param = next((p['value'] for p in transfer_condition.get('parameters', []) if p['name'] == '_nftHolder'), None) + transfer_condition = find_service_condition_by_name(service, "transferNFT") + contract_param = next( + ( + p["value"] + for p in transfer_condition.get("parameters", []) + if p["name"] == "_nftHolder" + ), + None, + ) + + return contract_param if contract_param is not None else "" - return contract_param if contract_param is not None else '' -def get_nft_transfer(did_doc: Dict[str, Any], type: str = 'nft-sales') -> str: +def get_nft_transfer(did_doc: Dict[str, Any], type: str = "nft-sales") -> str: """Get the NFT holder of a DID.""" service = find_service_by_type(did_doc, type) - transfer_condition = find_service_condition_by_name(service, 'transferNFT') - contract_param = next((p['value'] for p in transfer_condition.get('parameters', []) if p['name'] == '_nftTransfer'), None) + transfer_condition = find_service_condition_by_name(service, "transferNFT") + contract_param = next( + ( + p["value"] + for p in transfer_condition.get("parameters", []) + if p["name"] == "_nftTransfer" + ), + None, + ) - return contract_param if contract_param is not None else '' + return contract_param if contract_param is not None else "" def no_did_prefixed(input_string: str) -> str: @@ -118,20 +163,21 @@ def no_did_prefixed(input_string: str) -> str: def did_transformer(input_string: str, prefix_output: bool = False) -> str: """Transform a string to a DID.""" - pattern = re.compile(r'^(?:0x|did:nv:)*([a-f0-9]{64})$', re.IGNORECASE) + pattern = re.compile(r"^(?:0x|did:nv:)*([a-f0-9]{64})$", re.IGNORECASE) match_result = input_match(input_string, pattern) - valid, output = match_result['valid'], match_result['output'] + valid, output = match_result["valid"], match_result["output"] - return ('did:nv:' if prefix_output and valid else '') + output + return ("did:nv:" if prefix_output and valid else "") + output def input_match(input_string: str, pattern: re.Pattern[str]) -> Dict[str, Any]: + """Match an input string with a pattern.""" match_result = re.match(pattern, input_string) if match_result: - return {'valid': True, 'output': match_result.group(1)} + return {"valid": True, "output": match_result.group(1)} else: - return {'valid': False, 'output': ''} + return {"valid": False, "output": ""} def hash_data( @@ -139,67 +185,99 @@ def hash_data( values: List[Any], ) -> str: """Hash data.""" - encoded_data = Web3.solidity_keccak(types, values) - return encoded_data.hex() + encoded_data = encode(types, values) + return Web3.keccak(encoded_data).hex() def short_id(did: str) -> str: """Get the short ID of a DID.""" - return did.replace('did:nv:', '') + return did.replace("did:nv:", "") def get_agreement_id(seed: str, creator: str) -> str: """Get the agreement ID.""" seed_0x = zero_x_transformer(seed) creator_0x = Web3.to_checksum_address(creator) - return hash_data(['bytes32', 'address'], [seed_0x, creator_0x]) + return hash_data(["bytes32", "address"], [bytes.fromhex(seed_0x[2:]), creator_0x]) def get_lock_payment_seed( + agreement_id: str, did_doc: Dict[str, Any], + lock_payment_condition_address: str, escrow_payment_condition_address: str, token_address: str, amounts: List[int], receivers: List[str], -) -> str: +) -> Tuple[str, str]: """Get the lock payment seed.""" - short_id_ = zero_x_transformer(short_id(did_doc['id'])) - escrow_payment_condition_address_0x = zero_x_transformer(escrow_payment_condition_address) + short_id_ = zero_x_transformer(short_id(did_doc["id"])) + escrow_payment_condition_address_0x = zero_x_transformer( + escrow_payment_condition_address + ) token_address = Web3.to_checksum_address(token_address) receivers = [Web3.to_checksum_address(receiver) for receiver in receivers] - return hash_data( - ['bytes32', 'bytes32', 'address', 'uint256[]', 'address[]'], - [short_id_, escrow_payment_condition_address_0x, token_address, amounts, receivers], + hash_values = hash_data( + ["bytes32", "address", "address", "uint256[]", "address[]"], + [ + bytes.fromhex(short_id_[2:]), + escrow_payment_condition_address_0x, + token_address, + amounts, + receivers, + ], + ) + return hash_values, hash_data( + ["bytes32", "address", "bytes32"], + [ + bytes.fromhex(agreement_id[2:]), + lock_payment_condition_address, + bytes.fromhex(hash_values[2:]), + ], ) + def get_transfer_nft_condition_seed( + agreement_id: str, did_doc: Dict[str, Any], buyer_address: str, nft_amount: int, + transfer_nft_condition_address: str, lock_condition_id: str, nft_contract_address: str, expiration: int = 0, -) -> str: +) -> Tuple[str, str]: """Get the lock payment seed.""" - short_id_ = zero_x_transformer(short_id(did_doc['id'])) + short_id_ = zero_x_transformer(short_id(did_doc["id"])) nft_holder = Web3.to_checksum_address(get_nft_holder(did_doc)) - will_transfer = get_nft_transfer(did_doc) == 'true' + will_transfer = get_nft_transfer(did_doc) == "true" - return hash_data( - ['bytes32', 'address', 'address', 'uint256', 'bytes32', 'address', 'bool'], + hash_values = hash_data( + ["bytes32", "address", "address", "uint256", "bytes32", "address", "bool"], [ - short_id_, + bytes.fromhex(short_id_[2:]), nft_holder, Web3.to_checksum_address(buyer_address), nft_amount, - lock_condition_id, + bytes.fromhex(lock_condition_id[2:]), Web3.to_checksum_address(nft_contract_address), will_transfer, ], ) + return hash_values, hash_data( + ["bytes32", "address", "bytes32"], + [ + bytes.fromhex(agreement_id[2:]), + transfer_nft_condition_address, + bytes.fromhex(hash_values[2:]), + ], + ) + + def get_escrow_payment_seed( + agreement_id: str, did_doc: Dict[str, Any], amounts: List[int], receivers: List[str], @@ -208,79 +286,88 @@ def get_escrow_payment_seed( token_address: str, lock_seed: str, access_seed: str, -) -> str: +) -> Tuple[str, str]: """Get the escrow payment seed.""" - short_id_ = zero_x_transformer(short_id(did_doc['id'])) - escrow_payment_condition_address = Web3.to_checksum_address(escrow_payment_condition_address) + short_id_ = zero_x_transformer(short_id(did_doc["id"])) + escrow_payment_condition_address = Web3.to_checksum_address( + escrow_payment_condition_address + ) receivers = [Web3.to_checksum_address(receiver) for receiver in receivers] buyer_address = Web3.to_checksum_address(buyer_address) token_address = Web3.to_checksum_address(token_address) - return hash_data( - ['bytes32', 'uint256[]', 'address[]', 'address', 'address', 'address', 'bytes32', 'bytes32'], - [short_id_, amounts, receivers, buyer_address, escrow_payment_condition_address, token_address, lock_seed, access_seed] + values_hash = hash_data( + [ + "bytes32", + "uint256[]", + "address[]", + "address", + "address", + "address", + "bytes32", + "bytes32[]", + ], + [ + bytes.fromhex(short_id_[2:]), + amounts, + receivers, + buyer_address, + escrow_payment_condition_address, + token_address, + bytes.fromhex(lock_seed[2:]), + [bytes.fromhex(access_seed[2:])], + ], + ) + + return values_hash, hash_data( + ["bytes32", "address", "bytes32"], + [ + bytes.fromhex(agreement_id[2:]), + escrow_payment_condition_address, + bytes.fromhex(values_hash[2:]), + ], ) def get_timeouts_and_timelocks(did_doc: Dict[str, Any]) -> Tuple[List[int], List[int]]: """Get timeouts and timelocks""" - type = 'nft-sales' + type = "nft-sales" service = find_service_by_type(did_doc, type) - conditions = service.get('attributes', {}).get('serviceAgreementTemplate', {}).get('conditions', []) + conditions = ( + service.get("attributes", {}) + .get("serviceAgreementTemplate", {}) + .get("conditions", []) + ) timeouts, timelocks = [], [] for condition in conditions: - timeouts.append(condition.get('timeout', 0)) - timelocks.append(condition.get('timelock', 0)) + timeouts.append(condition.get("timeout", 0)) + timelocks.append(condition.get("timelock", 0)) return timeouts, timelocks -def get_reward_address(did_doc: Dict[str, Any], type: str = 'nft-sales') -> str: +def get_reward_address(did_doc: Dict[str, Any], type: str = "nft-sales") -> str: """Get the reward address of a DID.""" service = find_service_by_type(did_doc, type) - transfer_condition = find_service_condition_by_name(service, 'lockPayment') - contract_param = next((p['value'] for p in transfer_condition.get('parameters', []) if p['name'] == '_rewardAddress'), None) + transfer_condition = find_service_condition_by_name(service, "lockPayment") + contract_param = next( + ( + p["value"] + for p in transfer_condition.get("parameters", []) + if p["name"] == "_rewardAddress" + ), + None, + ) - return contract_param if contract_param is not None else '' + return contract_param if contract_param is not None else "" def get_creator(did_doc: Dict[str, Any]) -> str: """Get the creator of a DID.""" - return did_doc['proof']['creator'] + return did_doc["proof"]["creator"] + def get_claim_endpoint(did_doc: Dict[str, Any]) -> str: """Get the claim endpoint of a DID.""" - service = find_service_by_type(did_doc, 'nft-sales') - return service['serviceEndpoint'] - - - -# TODO: remove -res = requests.get('https://marketplace-api.gnosis.nevermined.app/api/v1/metadata/assets/ddo/did:nv:416e35cb209ecbfbf23e1192557b06e94c5d9a9afb025cce2e9baff23e907195') -did_doc = res.json() -price = get_price(did_doc) -print(get_reward_address(did_doc)) -print(get_claim_endpoint(did_doc)) -seed = get_lock_payment_seed( - did_doc, - '0x5e1d1eb61e1164d5a50b28c575da73a29595dff7', - '0x5e1d1eb61e1164d5a50b28c575da73a29595dff7', - list(price.values()), - list(price.keys()), -) -seed_access = get_transfer_nft_condition_seed( - did_doc, - '0x5e1d1eb61e1164d5a50b28c575da73a29595dff7', - 1, - seed, - '0x5e1d1eb61e1164d5a50b28c575da73a29595dff7', - ) -print( -get_escrow_payment_seed(did_doc, - list(price.values()), - list(price.keys()), - '0x5e1d1eb61e1164d5a50b28c575da73a29595dff7', - '0x5e1d1eb61e1164d5a50b28c575da73a29595dff7', - '0x5e1d1eb61e1164d5a50b28c575da73a29595dff7', - seed, - seed_access, )) \ No newline at end of file + service = find_service_by_type(did_doc, "nft-sales") + return service["serviceEndpoint"] diff --git a/packages/valory/skills/trader_abci/composition.py b/packages/valory/skills/trader_abci/composition.py index d6afd48a8..933b24f94 100644 --- a/packages/valory/skills/trader_abci/composition.py +++ b/packages/valory/skills/trader_abci/composition.py @@ -25,14 +25,18 @@ ) from packages.valory.skills.abstract_round_abci.base import BackgroundAppConfig from packages.valory.skills.decision_maker_abci.rounds import DecisionMakerAbciApp +from packages.valory.skills.decision_maker_abci.states.claim_subscription import ( + ClaimRound, +) from packages.valory.skills.decision_maker_abci.states.decision_receive import ( DecisionReceiveRound, ) from packages.valory.skills.decision_maker_abci.states.final_states import ( FinishedDecisionMakerRound, + FinishedSubscriptionRound, FinishedWithoutDecisionRound, FinishedWithoutRedeemingRound, - RefillRequiredRound, FinishedSubscriptionRound, + RefillRequiredRound, ) from packages.valory.skills.decision_maker_abci.states.handle_failed_tx import ( HandleFailedTxRound, @@ -80,6 +84,7 @@ FinishedDecisionRequestTxRound, FinishedRedeemingTxRound, FinishedStakingTxRound, + FinishedSubscriptionTxRound, PostTxSettlementRound, PreTxSettlementRound, TxSettlementMultiplexerAbciApp, @@ -94,6 +99,7 @@ ChecksPassedRound: RandomnessTransactionSubmissionRound, RefillRequiredRound: ResetAndPauseRound, FinishedTransactionSubmissionRound: PostTxSettlementRound, + FinishedSubscriptionTxRound: ClaimRound, FailedTransactionSubmissionRound: HandleFailedTxRound, FinishedDecisionRequestTxRound: DecisionReceiveRound, FinishedSubscriptionRound: PreTxSettlementRound, diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index d277e845c..1a0a91a63 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -25,8 +25,8 @@ skills: - valory/transaction_settlement_abci:0.1.0:bafybeidsfwslnbhhhplvgteeec7idrhm7gxpay4f36wwnkgl4mh7ogovke - valory/termination_abci:0.1.0:bafybeid5ipudhwuiuhbzvpn4usgdm3a3ow3naafuefvetmgbbcy6ugyuwi - valory/market_manager_abci:0.1.0:bafybeicqjiqq63bcb6colaq4adwsn7o6zhyd7n5ftwdv4kvt3rqxhnapw4 -- valory/decision_maker_abci:0.1.0:bafybeih72hy7st6muq6ojfawtmrndafwkq4v36mp3cula23tt255yus2je -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeighevqttuxh2zy5eux6ff24clan2het472th57mjub2onn6qq3oe4 +- valory/decision_maker_abci:0.1.0:bafybeifyqwmodmic6if4rjj3v5g5pehzwl7bjir2heoqbm5gsdmp3pdoey +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeidtxu67k3p5hv7zxgc72nw72h7nrum3sl3bk33bokepgcw224tjb4 - valory/staking_abci:0.1.0:bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u behaviours: main: @@ -181,6 +181,29 @@ models: refill_check_interval: 10 redeem_round_timeout: 3600.0 tool_punishment_multiplier: 1 + mech_to_subscription_params: + - - base_url + - https://marketplace-api.gnosis.nevermined.app/api/v1/metadata/assets/ddo + - - did + - did:nv:416e35cb209ecbfbf23e1192557b06e94c5d9a9afb025cce2e9baff23e907195 + - - escrow_payment_condition_address + - '0x9dDC4F1Ea5b94C138A23b60EC48c0d01d172629a' + - - lock_payment_condition_address + - '0xDE85A368Ee6f374d236500d176814365370778dA' + - - transfer_nft_condition_address + - '0xbBa4A25262745a55f020D0a3E9a82c25bb6F4979' + - - token_address + - '0xa30DE8C6aC39B825192e5F1FADe0770332D279A8' + - - order_address + - '0xc7751eff5396a846e7bc83ac31d3cb7d37cb49e4' + - - nft_amount + - '1' + - - payment_token + - '0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83' + - - order_address + - '0xc7751eff5396a846e7bc83ac31d3cb7d37cb49e4' + - - price + - '0' contract_timeout: 300.0 file_hash_to_strategies_json: - - hash diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/rounds.py b/packages/valory/skills/tx_settlement_multiplexer_abci/rounds.py index c97e4cc9c..4b66e93e1 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/rounds.py +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/rounds.py @@ -41,6 +41,9 @@ from packages.valory.skills.decision_maker_abci.states.decision_request import ( DecisionRequestRound, ) +from packages.valory.skills.decision_maker_abci.states.order_subscription import ( + SubscriptionRound, +) from packages.valory.skills.decision_maker_abci.states.redeem import RedeemRound from packages.valory.skills.staking_abci.rounds import CallCheckpointRound @@ -54,6 +57,7 @@ class Event(Enum): BET_PLACEMENT_DONE = "bet_placement_done" REDEEMING_DONE = "redeeming_done" STAKING_DONE = "staking_done" + SUBSCRIPTION_DONE = "subscription_done" ROUND_TIMEOUT = "round_timeout" UNRECOGNIZED = "unrecognized" NO_MAJORITY = "no_majority" @@ -92,6 +96,7 @@ def end_block(self) -> Optional[Tuple[BaseSynchronizedData, Enum]]: BetPlacementRound.auto_round_id(): Event.BET_PLACEMENT_DONE, RedeemRound.auto_round_id(): Event.REDEEMING_DONE, CallCheckpointRound.auto_round_id(): Event.STAKING_DONE, + SubscriptionRound.auto_round_id(): Event.SUBSCRIPTION_DONE, } synced_data = SynchronizedData(self.synchronized_data.db) @@ -127,6 +132,10 @@ class FinishedStakingTxRound(DegenerateRound): """Finished staking round.""" +class FinishedSubscriptionTxRound(DegenerateRound): + """Finished subscription round.""" + + class FailedMultiplexerRound(DegenerateRound): """Round that represents failure in identifying the transmitter round.""" @@ -178,12 +187,14 @@ class TxSettlementMultiplexerAbciApp(AbciApp[Event]): Event.BET_PLACEMENT_DONE: FinishedBetPlacementTxRound, Event.REDEEMING_DONE: FinishedRedeemingTxRound, Event.STAKING_DONE: FinishedStakingTxRound, + Event.SUBSCRIPTION_DONE: FinishedSubscriptionTxRound, Event.ROUND_TIMEOUT: PostTxSettlementRound, Event.UNRECOGNIZED: FailedMultiplexerRound, }, ChecksPassedRound: {}, FinishedDecisionRequestTxRound: {}, FinishedBetPlacementTxRound: {}, + FinishedSubscriptionTxRound: {}, FinishedRedeemingTxRound: {}, FinishedStakingTxRound: {}, FailedMultiplexerRound: {}, @@ -197,6 +208,7 @@ class TxSettlementMultiplexerAbciApp(AbciApp[Event]): FinishedBetPlacementTxRound, FinishedRedeemingTxRound, FinishedStakingTxRound, + FinishedSubscriptionTxRound, FailedMultiplexerRound, } db_pre_conditions: Dict[AppState, Set[str]] = { @@ -210,4 +222,5 @@ class TxSettlementMultiplexerAbciApp(AbciApp[Event]): FinishedRedeemingTxRound: set(), FinishedStakingTxRound: set(), FailedMultiplexerRound: set(), + FinishedSubscriptionTxRound: set(), } diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index 19d7035a1..243626bdd 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -21,7 +21,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru skills: - valory/abstract_round_abci:0.1.0:bafybeidbmd2cgffqqfwsyxws5dffsc6nbt5ijgkbhyzse5i42yddmwqlpy -- valory/decision_maker_abci:0.1.0:bafybeih72hy7st6muq6ojfawtmrndafwkq4v36mp3cula23tt255yus2je +- valory/decision_maker_abci:0.1.0:bafybeifyqwmodmic6if4rjj3v5g5pehzwl7bjir2heoqbm5gsdmp3pdoey - valory/staking_abci:0.1.0:bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u behaviours: main: diff --git a/tox.ini b/tox.ini index fe579ee9a..f60228760 100644 --- a/tox.ini +++ b/tox.ini @@ -309,6 +309,10 @@ ignore_errors=True [mypy-packages.valory.skills.abstract_round_abci.*] ignore_errors=True +[mypy-eth_abi.*] +ignore_errors=True +ignore_missing_imports= True + [mypy-packages.valory.skills.registration_abci.*] ignore_errors=True From 8747905708b909ee530ab05fd9c42115359d7295 Mon Sep 17 00:00:00 2001 From: Ardian Date: Fri, 19 Jan 2024 12:54:28 +0100 Subject: [PATCH 07/12] feat: add params --- packages/packages.json | 12 +-- packages/valory/agents/trader/aea-config.yaml | 18 +++- .../build/TransferNFTCondition.json | 95 +++++++++++++++---- .../transfer_nft_condition/contract.py | 17 ++++ .../transfer_nft_condition/contract.yaml | 8 +- packages/valory/services/trader/service.yaml | 42 +++++++- .../behaviours/order_subscription.py | 24 +++-- .../skills/decision_maker_abci/models.py | 1 + .../skills/decision_maker_abci/rounds.py | 1 + .../skills/decision_maker_abci/skill.yaml | 27 +++--- packages/valory/skills/trader_abci/skill.yaml | 51 +++++----- .../tx_settlement_multiplexer_abci/skill.yaml | 4 +- 12 files changed, 219 insertions(+), 81 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index 6e5f71736..e14c4ee13 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -1,13 +1,13 @@ { "dev": { "skill/valory/market_manager_abci/0.1.0": "bafybeicqjiqq63bcb6colaq4adwsn7o6zhyd7n5ftwdv4kvt3rqxhnapw4", - "skill/valory/decision_maker_abci/0.1.0": "bafybeifyqwmodmic6if4rjj3v5g5pehzwl7bjir2heoqbm5gsdmp3pdoey", - "skill/valory/trader_abci/0.1.0": "bafybeifrb2kr6y5h3qcuayqggfptgdapmyqj5iabthkcaw3zgjicbkqp4u", + "skill/valory/decision_maker_abci/0.1.0": "bafybeibnmgkfw56qdgcjrziyqulxzedb5p5jjjwaam7annf4tkgjwohrze", + "skill/valory/trader_abci/0.1.0": "bafybeidhod53n24md3zfa7vophg53rbaqc7fdkekwsmcvfr3y5urs4hvny", "contract/valory/market_maker/0.1.0": "bafybeihcueo3ct3h5fqyrwsjeofr5winyxlnegnwdvofopwhrfzkhgpxte", - "agent/valory/trader/0.1.0": "bafybeiadeayrkx6errhyeikaj2gj6jsij3jf5wrkzbyjp3pn5ik4eeufta", - "service/valory/trader/0.1.0": "bafybeifwssmq7r2pzbqjfouj3hwmyzk7d2wuni566tqnj3uwtz6zd5mi64", + "agent/valory/trader/0.1.0": "bafybeiddrqraqzfxbtx6zhnwk4kjfw5bkghb4ikudn3ohqgwnrlmxkweda", + "service/valory/trader/0.1.0": "bafybeig74jhyg2y75znb63hmh7jh6caykjzphb4jur62amjmmfekd3pltm", "contract/valory/erc20/0.1.0": "bafybeiecuaahlywb2rw6s76av5rdqg4gad6j753to6aqrix7zmbbt6kj6q", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeidtxu67k3p5hv7zxgc72nw72h7nrum3sl3bk33bokepgcw224tjb4", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeicnn2e7muwanfm7frkfod66vuqqbdj7dta6wryqalv4xzo7tr2viq", "contract/valory/mech/0.1.0": "bafybeigmkbovcb6wcfqkkmmryo6kzqsai5qq325lzmsvtlxe4fn6rcmwoy", "contract/valory/realitio/0.1.0": "bafybeic5ie4oodetj4krdogydvbfxg4qggc3matpiflocah626tpevpreq", "contract/valory/realitio_proxy/0.1.0": "bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4", @@ -15,7 +15,7 @@ "contract/valory/agent_registry/0.1.0": "bafybeib5czj6b3q6cukykbddo2nmn7etgmle53erq7ucapz5o7dzunno4a", "contract/valory/service_staking_token/0.1.0": "bafybeidhtmaaktcmg5j64e4btca4ngb67w7wjsecn55xcdcd6qmdg66ty4", "skill/valory/staking_abci/0.1.0": "bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u", - "contract/valory/transfer_nft_condition/0.1.0": "bafybeiava25cadkt3p42gbjpdcvdeoyb4doyrfhbfipldzwyl6hrjuwc3e" + "contract/valory/transfer_nft_condition/0.1.0": "bafybeihpwr5kdm6rhqwbnarhuao3nw45g65v47n53iap5werejuri3f2c4" }, "third_party": { "protocol/open_aea/signing/1.0.0": "bafybeie7xyems76v5b4wc2lmaidcujizpxfzjnnwdeokmhje53g7ym25ii", diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index 535eb7c43..166086b90 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -27,7 +27,7 @@ contracts: - valory/realitio_proxy:0.1.0:bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4 - valory/agent_registry:0.1.0:bafybeib5czj6b3q6cukykbddo2nmn7etgmle53erq7ucapz5o7dzunno4a - valory/service_staking_token:0.1.0:bafybeidhtmaaktcmg5j64e4btca4ngb67w7wjsecn55xcdcd6qmdg66ty4 -- valory/transfer_nft_condition:0.1.0:bafybeiava25cadkt3p42gbjpdcvdeoyb4doyrfhbfipldzwyl6hrjuwc3e +- valory/transfer_nft_condition:0.1.0:bafybeihpwr5kdm6rhqwbnarhuao3nw45g65v47n53iap5werejuri3f2c4 protocols: - open_aea/signing:1.0.0:bafybeie7xyems76v5b4wc2lmaidcujizpxfzjnnwdeokmhje53g7ym25ii - valory/abci:0.1.0:bafybeihmzlmmb4pdo3zkhg6ehuyaa4lhw7bfpclln2o2z7v3o6fcep26iu @@ -44,10 +44,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeida6w2afp4m3dvnbkbwxz67ozjlry3wpsbkxwz7usalm3o2ghy46u - valory/termination_abci:0.1.0:bafybeid5ipudhwuiuhbzvpn4usgdm3a3ow3naafuefvetmgbbcy6ugyuwi - valory/transaction_settlement_abci:0.1.0:bafybeidsfwslnbhhhplvgteeec7idrhm7gxpay4f36wwnkgl4mh7ogovke -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeidtxu67k3p5hv7zxgc72nw72h7nrum3sl3bk33bokepgcw224tjb4 +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeicnn2e7muwanfm7frkfod66vuqqbdj7dta6wryqalv4xzo7tr2viq - valory/market_manager_abci:0.1.0:bafybeicqjiqq63bcb6colaq4adwsn7o6zhyd7n5ftwdv4kvt3rqxhnapw4 -- valory/decision_maker_abci:0.1.0:bafybeifyqwmodmic6if4rjj3v5g5pehzwl7bjir2heoqbm5gsdmp3pdoey -- valory/trader_abci:0.1.0:bafybeifrb2kr6y5h3qcuayqggfptgdapmyqj5iabthkcaw3zgjicbkqp4u +- valory/decision_maker_abci:0.1.0:bafybeibnmgkfw56qdgcjrziyqulxzedb5p5jjjwaam7annf4tkgjwohrze +- valory/trader_abci:0.1.0:bafybeidhod53n24md3zfa7vophg53rbaqc7fdkekwsmcvfr3y5urs4hvny - valory/staking_abci:0.1.0:bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u default_ledger: ethereum required_ledgers: @@ -193,6 +193,16 @@ models: "openai-gpt-3.5-turbo", "openai-gpt-4", "stabilityai-stable-diffusion-v1-5", "stabilityai-stable-diffusion-xl-beta-v2-2-2", "stabilityai-stable-diffusion-512-v2-1", "stabilityai-stable-diffusion-768-v2-1"]} + use_nevermined: ${bool:true} + mech_to_subscription_params: ${list:[["base_url", "https://marketplace-api.gnosis.nevermined.app/api/v1/metadata/assets/ddo"], + ["did", "did:nv:416e35cb209ecbfbf23e1192557b06e94c5d9a9afb025cce2e9baff23e907195"], + ["escrow_payment_condition_address", "0x9dDC4F1Ea5b94C138A23b60EC48c0d01d172629a"], + ["lock_payment_condition_address", "0xDE85A368Ee6f374d236500d176814365370778dA"], + ["transfer_nft_condition_address", "0xbBa4A25262745a55f020D0a3E9a82c25bb6F4979"], + ["token_address", "0xa30DE8C6aC39B825192e5F1FADe0770332D279A8"], ["order_address", + "0xc7751eff5396a846e7bc83ac31d3cb7d37cb49e4"], ["nft_amount", "1"], ["payment_token", + "0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83"], ["order_address", "0xc7751eff5396a846e7bc83ac31d3cb7d37cb49e4"], + ["price", "0"]]} staking_contract_address: ${str:0x5add592ce0a1B5DceCebB5Dcac086Cd9F9e3eA5C} agent_balance_threshold: ${int:10000000000000000} refill_check_interval: ${int:10} diff --git a/packages/valory/contracts/transfer_nft_condition/build/TransferNFTCondition.json b/packages/valory/contracts/transfer_nft_condition/build/TransferNFTCondition.json index 42e053679..efb696034 100644 --- a/packages/valory/contracts/transfer_nft_condition/build/TransferNFTCondition.json +++ b/packages/valory/contracts/transfer_nft_condition/build/TransferNFTCondition.json @@ -987,6 +987,30 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -1020,25 +1044,58 @@ "type": "function" }, { - "constant": false, - "inputs": [ - {"name": "_id", "type": "bytes32"}, - {"name": "_did", "type": "bytes32"}, - {"name": "_conditionIds", "type": "bytes32[]"}, - {"name": "_timeLocks", "type": "uint256[]"}, - {"name": "_timeOuts", "type": "uint256[]"}, - {"name": "_accessConsumer", "type": "address"}, - {"name": "_idx", "type": "uint256"}, - {"name": "_rewardAddress", "type": "address"}, - {"name": "_tokenAddress", "type": "address"}, - {"name": "_amounts", "type": "uint256[]"}, - {"name": "_receivers", "type": "address[]"} - ], - "name": "createAgreementAndPayEscrow", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" + "constant": false, + "inputs": [ + { + "name": "_id", + "type": "bytes32" + }, + { + "name": "_did", + "type": "bytes32" + }, + { + "name": "_conditionIds", + "type": "bytes32[]" + }, + { + "name": "_timeLocks", + "type": "uint256[]" + }, + { + "name": "_timeOuts", + "type": "uint256[]" + }, + { + "name": "_accessConsumer", + "type": "address" + }, + { + "name": "_idx", + "type": "uint256" + }, + { + "name": "_rewardAddress", + "type": "address" + }, + { + "name": "_tokenAddress", + "type": "address" + }, + { + "name": "_amounts", + "type": "uint256[]" + }, + { + "name": "_receivers", + "type": "address[]" + } + ], + "name": "createAgreementAndPayEscrow", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" } ], "bytecode": "", diff --git a/packages/valory/contracts/transfer_nft_condition/contract.py b/packages/valory/contracts/transfer_nft_condition/contract.py index 413fd3f75..d6557185e 100644 --- a/packages/valory/contracts/transfer_nft_condition/contract.py +++ b/packages/valory/contracts/transfer_nft_condition/contract.py @@ -69,3 +69,20 @@ def build_order_tx( [Web3.to_checksum_address(receive) for receive in receives], )) return {"data": bytes.fromhex(data[2:])} + + + @classmethod + def balance_of( + cls, + ledger_api: LedgerApi, + contract_address: str, + address: str, + did: str, + ) -> JSONLike: + """Get the balance of an address.""" + contract_instance = cls.get_instance(ledger_api, contract_address) + balance = contract_instance.functions.balanceOf( + Web3.to_checksum_address(address), + int(did, 16) + ).call() + return dict(data=balance) diff --git a/packages/valory/contracts/transfer_nft_condition/contract.yaml b/packages/valory/contracts/transfer_nft_condition/contract.yaml index 0f8663369..009d86de1 100644 --- a/packages/valory/contracts/transfer_nft_condition/contract.yaml +++ b/packages/valory/contracts/transfer_nft_condition/contract.yaml @@ -8,8 +8,8 @@ aea_version: '>=1.0.0, <2.0.0' fingerprint: README.md: bafybeidiaep6cpoqlabnajvsgegpt72hqnbtozayicaxclzxzftopvlw5u __init__.py: bafybeigr6fpkchrud5tjrx5qevyk436jufe4zt6otkpbzsiergvyp64hs4 - build/TransferNFTCondition.json: bafybeigozlmtk3d3fggn5a2faiteqjujrkbgkvi54ee2jr4snse4nd3s2u - contract.py: bafybeihz5jeggunv4owoamcpgohs7qgnfjqicuxk3zv4hwbxzysnto3w7q + build/TransferNFTCondition.json: bafybeicovauoyn5bulnmz3ulkee56s46viemw3vpy7fk3zi4isol2jkdca + contract.py: bafybeig2wfwtn6kmdozoenxt3hp23srgpeebq4zyaxboqbs5em3rooordm fingerprint_ignore_patterns: [] contracts: [] class_name: TransferNftCondition @@ -21,9 +21,9 @@ dependencies: eth_typing: {} hexbytes: {} open-aea-ledger-ethereum: - version: ==1.43.0.post2 + version: ==1.43.0.post1 open-aea-test-autonomy: - version: ==0.13.9.post1 + version: ==0.13.9 packaging: {} py-eth-sig-utils: {} requests: diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index ac9dcafc8..80bcd3930 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeiadeayrkx6errhyeikaj2gj6jsij3jf5wrkzbyjp3pn5ik4eeufta +agent: valory/trader:0.1.0:bafybeiddrqraqzfxbtx6zhnwk4kjfw5bkghb4ikudn3ohqgwnrlmxkweda number_of_agents: 4 deployment: {} --- @@ -113,6 +113,16 @@ type: skill file_hash_to_strategies_json: ${FILE_HASH_TO_STRATEGIES_JSON:list:[["bafybeia4m2mzhedzjbm3enmhgd6csd6hredgwsgpgs2wm2j43vodeqxjfy",["bet_amount_per_threshold"]],["bafybeibtbw44oslyxqrgpnu644zcyc763phtr4rsglxb4b4ma4ha3k5kyq",["kelly_criterion"]]]} strategies_kwargs: ${STRATEGIES_KWARGS:list:[["bet_kelly_fraction",0.5],["floor_balance",500000000000000000],["bet_amount_per_threshold",{"0.0":0,"0.1":0,"0.2":0,"0.3":0,"0.4":0,"0.5":0,"0.6":60000000000000000,"0.7":90000000000000000,"0.8":100000000000000000,"0.9":1000000000000000000,"1.0":10000000000000000000}]]} use_subgraph_for_redeeming: ${USE_SUBGRAPH_FOR_REDEEMING:bool:true} + use_nevermined: ${USE_NEVERMINED:bool:false} + mech_to_subscription_params: ${SUBSCRIPTION_PARAMS:list:[["base_url", "https://marketplace-api.gnosis.nevermined.app/api/v1/metadata/assets/ddo"], + ["did", "did:nv:416e35cb209ecbfbf23e1192557b06e94c5d9a9afb025cce2e9baff23e907195"], + ["escrow_payment_condition_address", "0x9dDC4F1Ea5b94C138A23b60EC48c0d01d172629a"], + ["lock_payment_condition_address", "0xDE85A368Ee6f374d236500d176814365370778dA"], + ["transfer_nft_condition_address", "0xbBa4A25262745a55f020D0a3E9a82c25bb6F4979"], + ["token_address", "0xa30DE8C6aC39B825192e5F1FADe0770332D279A8"], ["order_address", + "0xc7751eff5396a846e7bc83ac31d3cb7d37cb49e4"], ["nft_amount", "1"], ["payment_token", + "0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83"], ["order_address", "0xc7751eff5396a846e7bc83ac31d3cb7d37cb49e4"], + ["price", "0"]]} benchmark_tool: &id004 args: log_dir: ${LOG_DIR:str:/benchmarks} @@ -197,6 +207,16 @@ type: skill file_hash_to_strategies_json: ${FILE_HASH_TO_STRATEGIES_JSON:list:[["bafybeia4m2mzhedzjbm3enmhgd6csd6hredgwsgpgs2wm2j43vodeqxjfy",["bet_amount_per_threshold"]],["bafybeibtbw44oslyxqrgpnu644zcyc763phtr4rsglxb4b4ma4ha3k5kyq",["kelly_criterion"]]]} strategies_kwargs: ${STRATEGIES_KWARGS:list:[["bet_kelly_fraction",0.5],["floor_balance",500000000000000000],["bet_amount_per_threshold",{"0.0":0,"0.1":0,"0.2":0,"0.3":0,"0.4":0,"0.5":0,"0.6":60000000000000000,"0.7":90000000000000000,"0.8":100000000000000000,"0.9":1000000000000000000,"1.0":10000000000000000000}]]} use_subgraph_for_redeeming: ${USE_SUBGRAPH_FOR_REDEEMING:bool:true} + use_nevermined: ${USE_NEVERMINED:bool:false} + mech_to_subscription_params: ${SUBSCRIPTION_PARAMS:list:[["base_url", "https://marketplace-api.gnosis.nevermined.app/api/v1/metadata/assets/ddo"], + ["did", "did:nv:416e35cb209ecbfbf23e1192557b06e94c5d9a9afb025cce2e9baff23e907195"], + ["escrow_payment_condition_address", "0x9dDC4F1Ea5b94C138A23b60EC48c0d01d172629a"], + ["lock_payment_condition_address", "0xDE85A368Ee6f374d236500d176814365370778dA"], + ["transfer_nft_condition_address", "0xbBa4A25262745a55f020D0a3E9a82c25bb6F4979"], + ["token_address", "0xa30DE8C6aC39B825192e5F1FADe0770332D279A8"], ["order_address", + "0xc7751eff5396a846e7bc83ac31d3cb7d37cb49e4"], ["nft_amount", "1"], ["payment_token", + "0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83"], ["order_address", "0xc7751eff5396a846e7bc83ac31d3cb7d37cb49e4"], + ["price", "0"]]} benchmark_tool: *id004 2: models: @@ -279,6 +299,16 @@ type: skill file_hash_to_strategies_json: ${FILE_HASH_TO_STRATEGIES_JSON:list:[["bafybeia4m2mzhedzjbm3enmhgd6csd6hredgwsgpgs2wm2j43vodeqxjfy",["bet_amount_per_threshold"]],["bafybeibtbw44oslyxqrgpnu644zcyc763phtr4rsglxb4b4ma4ha3k5kyq",["kelly_criterion"]]]} strategies_kwargs: ${STRATEGIES_KWARGS:list:[["bet_kelly_fraction",0.5],["floor_balance",500000000000000000],["bet_amount_per_threshold",{"0.0":0,"0.1":0,"0.2":0,"0.3":0,"0.4":0,"0.5":0,"0.6":60000000000000000,"0.7":90000000000000000,"0.8":100000000000000000,"0.9":1000000000000000000,"1.0":10000000000000000000}]]} use_subgraph_for_redeeming: ${USE_SUBGRAPH_FOR_REDEEMING:bool:true} + use_nevermined: ${USE_NEVERMINED:bool:false} + mech_to_subscription_params: ${SUBSCRIPTION_PARAMS:list:[["base_url", "https://marketplace-api.gnosis.nevermined.app/api/v1/metadata/assets/ddo"], + ["did", "did:nv:416e35cb209ecbfbf23e1192557b06e94c5d9a9afb025cce2e9baff23e907195"], + ["escrow_payment_condition_address", "0x9dDC4F1Ea5b94C138A23b60EC48c0d01d172629a"], + ["lock_payment_condition_address", "0xDE85A368Ee6f374d236500d176814365370778dA"], + ["transfer_nft_condition_address", "0xbBa4A25262745a55f020D0a3E9a82c25bb6F4979"], + ["token_address", "0xa30DE8C6aC39B825192e5F1FADe0770332D279A8"], ["order_address", + "0xc7751eff5396a846e7bc83ac31d3cb7d37cb49e4"], ["nft_amount", "1"], ["payment_token", + "0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83"], ["order_address", "0xc7751eff5396a846e7bc83ac31d3cb7d37cb49e4"], + ["price", "0"]]} benchmark_tool: *id004 3: models: @@ -361,6 +391,16 @@ type: skill file_hash_to_strategies_json: ${FILE_HASH_TO_STRATEGIES_JSON:list:[["bafybeia4m2mzhedzjbm3enmhgd6csd6hredgwsgpgs2wm2j43vodeqxjfy",["bet_amount_per_threshold"]],["bafybeibtbw44oslyxqrgpnu644zcyc763phtr4rsglxb4b4ma4ha3k5kyq",["kelly_criterion"]]]} strategies_kwargs: ${STRATEGIES_KWARGS:list:[["bet_kelly_fraction",0.5],["floor_balance",500000000000000000],["bet_amount_per_threshold",{"0.0":0,"0.1":0,"0.2":0,"0.3":0,"0.4":0,"0.5":0,"0.6":60000000000000000,"0.7":90000000000000000,"0.8":100000000000000000,"0.9":1000000000000000000,"1.0":10000000000000000000}]]} use_subgraph_for_redeeming: ${USE_SUBGRAPH_FOR_REDEEMING:bool:true} + use_nevermined: ${USE_NEVERMINED:bool:false} + mech_to_subscription_params: ${SUBSCRIPTION_PARAMS:list:[["base_url", "https://marketplace-api.gnosis.nevermined.app/api/v1/metadata/assets/ddo"], + ["did", "did:nv:416e35cb209ecbfbf23e1192557b06e94c5d9a9afb025cce2e9baff23e907195"], + ["escrow_payment_condition_address", "0x9dDC4F1Ea5b94C138A23b60EC48c0d01d172629a"], + ["lock_payment_condition_address", "0xDE85A368Ee6f374d236500d176814365370778dA"], + ["transfer_nft_condition_address", "0xbBa4A25262745a55f020D0a3E9a82c25bb6F4979"], + ["token_address", "0xa30DE8C6aC39B825192e5F1FADe0770332D279A8"], ["order_address", + "0xc7751eff5396a846e7bc83ac31d3cb7d37cb49e4"], ["nft_amount", "1"], ["payment_token", + "0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83"], ["order_address", "0xc7751eff5396a846e7bc83ac31d3cb7d37cb49e4"], + ["price", "0"]]} benchmark_tool: *id004 --- public_id: valory/ledger:0.19.0 diff --git a/packages/valory/skills/decision_maker_abci/behaviours/order_subscription.py b/packages/valory/skills/decision_maker_abci/behaviours/order_subscription.py index 881f14746..190682376 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/order_subscription.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/order_subscription.py @@ -221,16 +221,19 @@ def _prepare_approval_tx( ) return True - def _get_balance(self, token: str, address: str) -> Generator[None, None, bool]: + def _get_balance( + self, token: str, address: str, did: str + ) -> Generator[None, None, bool]: """Prepare an approval tx.""" result = yield from self.contract_interact( performative=ContractApiMessage.Performative.GET_RAW_TRANSACTION, # type: ignore contract_address=token, - contract_public_id=ERC20.contract_id, - contract_callable="check_balance", - data_key="token", + contract_public_id=TransferNftCondition.contract_id, + contract_callable="balance_of", + data_key="data", placeholder="balance", - account=address, + address=address, + did=did, ) if not result: return False @@ -238,8 +241,14 @@ def _get_balance(self, token: str, address: str) -> Generator[None, None, bool]: def _should_purchase(self) -> Generator[None, None, bool]: """Check if the subscription should be purchased.""" + if not self.params.use_nevermined: + self.context.logger.info("Nevermined subscriptions are turned off.") + return False + result = yield from self._get_balance( - self.token_address, self.synchronized_data.safe_contract_address + self.token_address, + self.synchronized_data.safe_contract_address, + zero_x_transformer(no_did_prefixed(self.did)), ) if not result: self.context.logger.warning("Failed to get balance") @@ -249,7 +258,8 @@ def _should_purchase(self) -> Generator[None, None, bool]: def get_payload_content(self) -> Generator[None, None, str]: """Get the payload.""" - if not self._should_purchase(): + should_purchase = yield from self._should_purchase() + if not should_purchase: return SubscriptionRound.NO_TX_PAYLOAD approval_params = self._get_approval_params() diff --git a/packages/valory/skills/decision_maker_abci/models.py b/packages/valory/skills/decision_maker_abci/models.py index bd3e24178..7ce355b61 100644 --- a/packages/valory/skills/decision_maker_abci/models.py +++ b/packages/valory/skills/decision_maker_abci/models.py @@ -320,6 +320,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: kwargs, bool, ) + self.use_nevermined = self._ensure("use_nevermined", kwargs, bool) self.mech_to_subscription_params: Dict[ str, Any ] = nested_list_todict_workaround( diff --git a/packages/valory/skills/decision_maker_abci/rounds.py b/packages/valory/skills/decision_maker_abci/rounds.py index 7bbe92189..3961ed8a1 100644 --- a/packages/valory/skills/decision_maker_abci/rounds.py +++ b/packages/valory/skills/decision_maker_abci/rounds.py @@ -153,6 +153,7 @@ class DecisionMakerAbciApp(AbciApp[Event]): }, SubscriptionRound: { Event.DONE: FinishedSubscriptionRound, + Event.NO_SUBSCRIPTION: ToolSelectionRound, Event.SUBSCRIPTION_ERROR: SubscriptionRound, Event.NO_MAJORITY: SubscriptionRound, Event.ROUND_TIMEOUT: SubscriptionRound, diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index e6a78a70f..fd33dbe50 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -12,16 +12,16 @@ fingerprint: README.md: bafybeia367zzdwndvlhw27rvnwodytjo3ms7gbc3q7mhrrjqjgfasnk47i __init__.py: bafybeih563ujnigeci2ldzh7hakbau6a222vsed7leg3b7lq32vcn3nm4a behaviours/__init__.py: bafybeih6ddz2ocvm6x6ytvlbcz6oi4snb5ee5xh5h65nq4w2qf7fd7zfky - behaviours/base.py: bafybeib4kpmxv7svyvcb5ijp7ioohahfhjfsca7d4cijfijvs73g5nrsom + behaviours/base.py: bafybeieuyh6mbmvcjpwzwdoo6caop5gappqiz6sr3tbfxi2lobxol6cauq behaviours/bet_placement.py: bafybeigtz4uimsqjjwq4r5p3a5v6niqdtqezbuf2ghy6o7syhsh4k5gjfa behaviours/blacklisting.py: bafybeierwdzn6vav54l6zym77hhx2vdx3jtnnwpbhwmwwyrqzncwjwkxu4 - behaviours/claim_subscription.py: bafybeibied3wtszqohpbox4ztojjxtkbn3eg7rsp4qn2pgkqjgzjoz47qa + behaviours/claim_subscription.py: bafybeihctnttpg5ckv5653iqwidbfxqif3ox35zwuaf52wfjfmpgtxv7em behaviours/decision_receive.py: bafybeidvae35fzdmf2hvn3lqkc67zgjy5enu3vi3z5duomlqmf2v4zvxza behaviours/decision_request.py: bafybeidhmhjxt5xjhznxchqqqh6ohdssyyyzuqxv6dfdvpza7c2bxigajq behaviours/handle_failed_tx.py: bafybeidxpc6u575ymct5tdwutvzov6zqfdoio5irgldn3fw7q3lg36mmxm - behaviours/order_subscription.py: bafybeiemehj3srtzs5nxpnmaes6mqtgw6vreh2kpiwni2443qh6j2b4qlq + behaviours/order_subscription.py: bafybeiehmurti6cmarlaqqgr45fou6js5gb4cbbul7n36chyb4ks3jxtay behaviours/reedem.py: bafybeibenzbek5qdtk3gobjxfmsm6tg6i3d4yltozymy23izpgbcpal5ye - behaviours/round_behaviour.py: bafybeifgx6x6ykdkxgsarjkua6pq4vwrbanit3gcwc3wwij6bwfk7yi7ta + behaviours/round_behaviour.py: bafybeicbvfc622elfkzag2xb3rnqvajg246izdpo5x5yvz22zv3vylbzc4 behaviours/sampling.py: bafybeifzhm4sspdvt227ksl5hjn26offgqpwempgbcwbr6dq7gyi2a46sm behaviours/tool_selection.py: bafybeifpvrrbftlkjsoiysnasihzttousk6hxnukzrln6z2d33e3zexkje dialogues.py: bafybeigpwuzku3we7axmxeamg7vn656maww6emuztau5pg3ebsoquyfdqm @@ -29,21 +29,21 @@ fingerprint: handlers.py: bafybeiggoetspwcvdojmbjdd67tmkoeedikmt6vsbcium3zjaljb6jzqu4 io_/__init__.py: bafybeifxgmmwjqzezzn3e6keh2bfo4cyo7y5dq2ept3stfmgglbrzfl5rq io_/loader.py: bafybeih3sdsx5dhe4kzhtoafexjgkutsujwqy3zcdrlrkhtdks45bc7exa - models.py: bafybeicug6vzpphd5e5paicaf5ewk3nhyrs7zlq77zkppgnbfhrpiyn5ye - payloads.py: bafybeiet7nycjiafyom4autm36ve3x74woi74aljhaxviwlja5kvpt2p6i + models.py: bafybeiay4dda2v2ywivkzolcexygd7bmju4imjtvolpk2ugq6jjqjnsjjm + payloads.py: bafybeiawjiqmqtp2tchpz3cojxlujrohly67me3q4shy2asu3nruq2ys6q policy.py: bafybeidpmx4ek3qze63zpuwixyf6t7bdv62ewgkzt3ljrzadiwdw64cueq redeem_info.py: bafybeifiiix4gihfo4avraxt34sfw35v6dqq45do2drrssei2shbps63mm - rounds.py: bafybeicnh2kfdxjmmrfia3cuelxdjwozmv3ul24kn7z4njrfddyv3dugju + rounds.py: bafybeigqnbpztzycfiud44d37kthdo7d6rysxxhwkn5suzlmqgdekgqwja states/__init__.py: bafybeid23llnyp6j257dluxmrnztugo5llsrog7kua53hllyktz4dqhqoy states/base.py: bafybeib3y5pmt52i747wxpnc7spwbrqim32vgju5ln46e22h4qvowhysom states/bet_placement.py: bafybeibalhxhp2c4oljmiwqi6ds3g36fgtabmf42mb5sgq6z22znrcbhda states/blacklisting.py: bafybeifruvxwwltndwazkzzbpc5nnnad3z5t5ofy6d3i7nssljbxl6gvxu - states/claim_subscription.py: bafybeigmxodnmvqll7tsnf73k3co6lrqvk6eu5aktwwc3d45a4zvm52vha + states/claim_subscription.py: bafybeifcvvyib7eeeuj5nhhr7r4tj6b7jsy6c45vpsiekpzseac2g5ldca states/decision_receive.py: bafybeib3roo27nccj4eylaqwwzztzzzwsi6px5atjrch5wbqmpln2kyy6y states/decision_request.py: bafybeic7otc3hjb753svbmur3yyk6szahc25yii3x4w4vcnpfz6jwvacuu - states/final_states.py: bafybeibo7x5dhkdp7qbq67z66t2vhjldea37stobjwbwoll3ai7oetbblm + states/final_states.py: bafybeieapzmpwkhoebcxpmhfkohwnxsh6gejnxzzsyzkx2os7bznhd33qu states/handle_failed_tx.py: bafybeihewm2vernvhktuorljdupjqcg2p5vs6wvsira2d62wkoyo5xlzjm - states/order_subscription.py: bafybeiajexthafj62delvh4mzhvqu7t2n4qtdv4qnwmwxefl3tgtfhkgr4 + states/order_subscription.py: bafybeih7nucymipmbqjup2ckwdkzcj7aarxezhdgdkbtazx45wr3cmna34 states/redeem.py: bafybeiblidmpt73ocac73wmakusrnf5267vs7s2foc5pqkrz4vuqgy3b4u states/sampling.py: bafybeidnvdogjlthjfe7jpaiuezm3xydrbxxukyoss4gx6t5fdin52rsta states/tool_selection.py: bafybeiaaijv6dukp3bmsptcwkcmumc6wu6ztzkvaqzsqqjbfn4ozgyuykq @@ -51,8 +51,8 @@ fingerprint: tests/behaviours/__init__.py: bafybeic7icz7lfhfepdkqkase7y7zn3a6pwdw6fx4ah2hajmgejawpolc4 tests/behaviours/test_base.py: bafybeidemmwjhtr6i4tq66jyqkpmb425ersfmk7k7zzjmeaz2idqnpcwve tests/conftest.py: bafybeidy5hw56kw5mxudnfbhvogofn6k4rqb4ux2bd45baedrrhmgyrude - utils/__init__.py: bafybeihrz3vkiyvvkona4tv4zchmyyserjhmq33u753t4k62a2rd3mtuiq - utils/nevermined.py: bafybeia7i7oqv5wlcdinyo7f6baanee7gx6zm4w3yqpp5tkpzxpgy4gmmq + utils/__init__.py: bafybeiazrfg3kwfdl5q45azwz6b6mobqxngxpf4hazmrnkhinpk4qhbbf4 + utils/nevermined.py: bafybeidw4ydwqo7dmdfu2oqx4lmgho5ciakthx6rj2iwgt7bywvnppbxuy fingerprint_ignore_patterns: [] connections: [] contracts: @@ -65,7 +65,7 @@ contracts: - valory/realitio:0.1.0:bafybeic5ie4oodetj4krdogydvbfxg4qggc3matpiflocah626tpevpreq - valory/realitio_proxy:0.1.0:bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4 - valory/agent_registry:0.1.0:bafybeib5czj6b3q6cukykbddo2nmn7etgmle53erq7ucapz5o7dzunno4a -- valory/transfer_nft_condition:0.1.0:bafybeiava25cadkt3p42gbjpdcvdeoyb4doyrfhbfipldzwyl6hrjuwc3e +- valory/transfer_nft_condition:0.1.0:bafybeihpwr5kdm6rhqwbnarhuao3nw45g65v47n53iap5werejuri3f2c4 protocols: - valory/contract_api:1.0.0:bafybeialhbjvwiwcnqq3ysxcyemobcbie7xza66gaofcvla5njezkvhcka - valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru @@ -199,6 +199,7 @@ models: slippage: 0.01 policy_epsilon: 0.1 use_subgraph_for_redeeming: true + use_nevermined: true mech_to_subscription_params: - - base_url - https://marketplace-api.gnosis.nevermined.app/api/v1/metadata/assets/ddo diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index 1a0a91a63..fdbabd408 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -9,7 +9,7 @@ fingerprint: README.md: bafybeiab4xgadptz4mhvno4p6xvkh7p4peg7iuhotabydriu74dmj6ljga __init__.py: bafybeido7wa33h4dtleap57vzgyb4fsofk4vindsqcekyfo5i56i2rll2a behaviours.py: bafybeieesrefrpo5c5upzztgm5fwfrmxeagilacuau5nacobhsfvgpbzby - composition.py: bafybeifr56wvckvyo5sz2rglnr4yhezwe2p6p4aifx7dokmuhz7vhrdkuu + composition.py: bafybeigokvn3xg2zju7gfiqydoonizxuxnwkoqkssglg4lgoymv2tnci74 dialogues.py: bafybeiebofyykseqp3fmif36cqmmyf3k7d2zbocpl6t6wnlpv4szghrxbm fsm_specification.yaml: bafybeib3ycl5bjo5uilyaly7uoovvc3b3gpjrkuvdos5ffsgmrs73j6bkm handlers.py: bafybeibkiqwe7hoqccjirimd44nzeqkabc7oo74romqklssion27s5sa2a @@ -25,8 +25,8 @@ skills: - valory/transaction_settlement_abci:0.1.0:bafybeidsfwslnbhhhplvgteeec7idrhm7gxpay4f36wwnkgl4mh7ogovke - valory/termination_abci:0.1.0:bafybeid5ipudhwuiuhbzvpn4usgdm3a3ow3naafuefvetmgbbcy6ugyuwi - valory/market_manager_abci:0.1.0:bafybeicqjiqq63bcb6colaq4adwsn7o6zhyd7n5ftwdv4kvt3rqxhnapw4 -- valory/decision_maker_abci:0.1.0:bafybeifyqwmodmic6if4rjj3v5g5pehzwl7bjir2heoqbm5gsdmp3pdoey -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeidtxu67k3p5hv7zxgc72nw72h7nrum3sl3bk33bokepgcw224tjb4 +- valory/decision_maker_abci:0.1.0:bafybeibnmgkfw56qdgcjrziyqulxzedb5p5jjjwaam7annf4tkgjwohrze +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeicnn2e7muwanfm7frkfod66vuqqbdj7dta6wryqalv4xzo7tr2viq - valory/staking_abci:0.1.0:bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u behaviours: main: @@ -181,29 +181,30 @@ models: refill_check_interval: 10 redeem_round_timeout: 3600.0 tool_punishment_multiplier: 1 + use_nevermined: true mech_to_subscription_params: - - - base_url - - https://marketplace-api.gnosis.nevermined.app/api/v1/metadata/assets/ddo - - - did - - did:nv:416e35cb209ecbfbf23e1192557b06e94c5d9a9afb025cce2e9baff23e907195 - - - escrow_payment_condition_address - - '0x9dDC4F1Ea5b94C138A23b60EC48c0d01d172629a' - - - lock_payment_condition_address - - '0xDE85A368Ee6f374d236500d176814365370778dA' - - - transfer_nft_condition_address - - '0xbBa4A25262745a55f020D0a3E9a82c25bb6F4979' - - - token_address - - '0xa30DE8C6aC39B825192e5F1FADe0770332D279A8' - - - order_address - - '0xc7751eff5396a846e7bc83ac31d3cb7d37cb49e4' - - - nft_amount - - '1' - - - payment_token - - '0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83' - - - order_address - - '0xc7751eff5396a846e7bc83ac31d3cb7d37cb49e4' - - - price - - '0' + - - base_url + - https://marketplace-api.gnosis.nevermined.app/api/v1/metadata/assets/ddo + - - did + - did:nv:416e35cb209ecbfbf23e1192557b06e94c5d9a9afb025cce2e9baff23e907195 + - - escrow_payment_condition_address + - '0x9dDC4F1Ea5b94C138A23b60EC48c0d01d172629a' + - - lock_payment_condition_address + - '0xDE85A368Ee6f374d236500d176814365370778dA' + - - transfer_nft_condition_address + - '0xbBa4A25262745a55f020D0a3E9a82c25bb6F4979' + - - token_address + - '0xa30DE8C6aC39B825192e5F1FADe0770332D279A8' + - - order_address + - '0xc7751eff5396a846e7bc83ac31d3cb7d37cb49e4' + - - nft_amount + - '1' + - - payment_token + - '0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83' + - - order_address + - '0xc7751eff5396a846e7bc83ac31d3cb7d37cb49e4' + - - price + - '0' contract_timeout: 300.0 file_hash_to_strategies_json: - - hash diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index 243626bdd..dbee56e99 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -13,7 +13,7 @@ fingerprint: fsm_specification.yaml: bafybeidwxjna36auqbtqlehx73kyb6o74suhzj5bothgtiapcj35b7gzve handlers.py: bafybeiafbqr7ojfcbwohvee7x4zzswad3ymfrrbjlfz7uuuttmn3qdfs6q models.py: bafybeigtmxoecoow663hgqnyinxarlrttyyt5ghpbdamdv4tc4kikcfx3a - rounds.py: bafybeictknoifjphmgviw3b6mh3srgqlw2lhfkedqu5fumoxuwpehlhioq + rounds.py: bafybeidqmmhwsvkoijlh52faliyw2pibyb4zg2fhx2to7uaioja5b7hcjy fingerprint_ignore_patterns: [] connections: [] contracts: [] @@ -21,7 +21,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru skills: - valory/abstract_round_abci:0.1.0:bafybeidbmd2cgffqqfwsyxws5dffsc6nbt5ijgkbhyzse5i42yddmwqlpy -- valory/decision_maker_abci:0.1.0:bafybeifyqwmodmic6if4rjj3v5g5pehzwl7bjir2heoqbm5gsdmp3pdoey +- valory/decision_maker_abci:0.1.0:bafybeibnmgkfw56qdgcjrziyqulxzedb5p5jjjwaam7annf4tkgjwohrze - valory/staking_abci:0.1.0:bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u behaviours: main: From 80b22ac228b88064282c0564fc7f9eae6de7869c Mon Sep 17 00:00:00 2001 From: Ardian Date: Fri, 19 Jan 2024 12:59:05 +0100 Subject: [PATCH 08/12] chore: copyright --- packages/packages.json | 12 +++++------ packages/valory/agents/trader/aea-config.yaml | 8 ++++---- .../transfer_nft_condition/__init__.py | 2 +- .../transfer_nft_condition/contract.py | 2 +- .../transfer_nft_condition/contract.yaml | 4 ++-- packages/valory/services/trader/service.yaml | 2 +- .../decision_maker_abci/behaviours/base.py | 2 +- .../behaviours/round_behaviour.py | 2 +- .../skills/decision_maker_abci/models.py | 2 +- .../skills/decision_maker_abci/payloads.py | 2 +- .../skills/decision_maker_abci/rounds.py | 2 +- .../skills/decision_maker_abci/skill.yaml | 20 +++++++++---------- .../skills/decision_maker_abci/states/base.py | 2 +- .../states/claim_subscription.py | 2 +- .../states/final_states.py | 2 +- .../states/order_subscription.py | 2 +- .../valory/skills/trader_abci/composition.py | 2 +- packages/valory/skills/trader_abci/skill.yaml | 6 +++--- .../tx_settlement_multiplexer_abci/rounds.py | 2 +- .../tx_settlement_multiplexer_abci/skill.yaml | 4 ++-- 20 files changed, 41 insertions(+), 41 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index e14c4ee13..83090e639 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -1,13 +1,13 @@ { "dev": { "skill/valory/market_manager_abci/0.1.0": "bafybeicqjiqq63bcb6colaq4adwsn7o6zhyd7n5ftwdv4kvt3rqxhnapw4", - "skill/valory/decision_maker_abci/0.1.0": "bafybeibnmgkfw56qdgcjrziyqulxzedb5p5jjjwaam7annf4tkgjwohrze", - "skill/valory/trader_abci/0.1.0": "bafybeidhod53n24md3zfa7vophg53rbaqc7fdkekwsmcvfr3y5urs4hvny", + "skill/valory/decision_maker_abci/0.1.0": "bafybeie4yoxb3icc4uqp3h7aaq2nvdjkn4osalgeboxrb6v7igtzns6jjy", + "skill/valory/trader_abci/0.1.0": "bafybeihu5n4xwdaedqyomdval4nmtmabq5azolynx2fo3xhmt7zurvmrwe", "contract/valory/market_maker/0.1.0": "bafybeihcueo3ct3h5fqyrwsjeofr5winyxlnegnwdvofopwhrfzkhgpxte", - "agent/valory/trader/0.1.0": "bafybeiddrqraqzfxbtx6zhnwk4kjfw5bkghb4ikudn3ohqgwnrlmxkweda", - "service/valory/trader/0.1.0": "bafybeig74jhyg2y75znb63hmh7jh6caykjzphb4jur62amjmmfekd3pltm", + "agent/valory/trader/0.1.0": "bafybeie3uyvnz6ql7niru5e34xe4ncxsa6i2kly5xsk6usc5g7xloxrmui", + "service/valory/trader/0.1.0": "bafybeib7jkhdtmsekjr6nzkm4u7rw3p7ejx2uc7srxgnujezttxsmwqsoi", "contract/valory/erc20/0.1.0": "bafybeiecuaahlywb2rw6s76av5rdqg4gad6j753to6aqrix7zmbbt6kj6q", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeicnn2e7muwanfm7frkfod66vuqqbdj7dta6wryqalv4xzo7tr2viq", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeiapmnedhjbk7k3wfmgclkumkzepgavxkemlyhxbgoh7n2xghlvuom", "contract/valory/mech/0.1.0": "bafybeigmkbovcb6wcfqkkmmryo6kzqsai5qq325lzmsvtlxe4fn6rcmwoy", "contract/valory/realitio/0.1.0": "bafybeic5ie4oodetj4krdogydvbfxg4qggc3matpiflocah626tpevpreq", "contract/valory/realitio_proxy/0.1.0": "bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4", @@ -15,7 +15,7 @@ "contract/valory/agent_registry/0.1.0": "bafybeib5czj6b3q6cukykbddo2nmn7etgmle53erq7ucapz5o7dzunno4a", "contract/valory/service_staking_token/0.1.0": "bafybeidhtmaaktcmg5j64e4btca4ngb67w7wjsecn55xcdcd6qmdg66ty4", "skill/valory/staking_abci/0.1.0": "bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u", - "contract/valory/transfer_nft_condition/0.1.0": "bafybeihpwr5kdm6rhqwbnarhuao3nw45g65v47n53iap5werejuri3f2c4" + "contract/valory/transfer_nft_condition/0.1.0": "bafybeihoeso5lhptekpvsrt77dxenyl2te45ujl7llyeaf2uv22affghre" }, "third_party": { "protocol/open_aea/signing/1.0.0": "bafybeie7xyems76v5b4wc2lmaidcujizpxfzjnnwdeokmhje53g7ym25ii", diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index 166086b90..c21e4e1a2 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -27,7 +27,7 @@ contracts: - valory/realitio_proxy:0.1.0:bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4 - valory/agent_registry:0.1.0:bafybeib5czj6b3q6cukykbddo2nmn7etgmle53erq7ucapz5o7dzunno4a - valory/service_staking_token:0.1.0:bafybeidhtmaaktcmg5j64e4btca4ngb67w7wjsecn55xcdcd6qmdg66ty4 -- valory/transfer_nft_condition:0.1.0:bafybeihpwr5kdm6rhqwbnarhuao3nw45g65v47n53iap5werejuri3f2c4 +- valory/transfer_nft_condition:0.1.0:bafybeihoeso5lhptekpvsrt77dxenyl2te45ujl7llyeaf2uv22affghre protocols: - open_aea/signing:1.0.0:bafybeie7xyems76v5b4wc2lmaidcujizpxfzjnnwdeokmhje53g7ym25ii - valory/abci:0.1.0:bafybeihmzlmmb4pdo3zkhg6ehuyaa4lhw7bfpclln2o2z7v3o6fcep26iu @@ -44,10 +44,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeida6w2afp4m3dvnbkbwxz67ozjlry3wpsbkxwz7usalm3o2ghy46u - valory/termination_abci:0.1.0:bafybeid5ipudhwuiuhbzvpn4usgdm3a3ow3naafuefvetmgbbcy6ugyuwi - valory/transaction_settlement_abci:0.1.0:bafybeidsfwslnbhhhplvgteeec7idrhm7gxpay4f36wwnkgl4mh7ogovke -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeicnn2e7muwanfm7frkfod66vuqqbdj7dta6wryqalv4xzo7tr2viq +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeiapmnedhjbk7k3wfmgclkumkzepgavxkemlyhxbgoh7n2xghlvuom - valory/market_manager_abci:0.1.0:bafybeicqjiqq63bcb6colaq4adwsn7o6zhyd7n5ftwdv4kvt3rqxhnapw4 -- valory/decision_maker_abci:0.1.0:bafybeibnmgkfw56qdgcjrziyqulxzedb5p5jjjwaam7annf4tkgjwohrze -- valory/trader_abci:0.1.0:bafybeidhod53n24md3zfa7vophg53rbaqc7fdkekwsmcvfr3y5urs4hvny +- valory/decision_maker_abci:0.1.0:bafybeie4yoxb3icc4uqp3h7aaq2nvdjkn4osalgeboxrb6v7igtzns6jjy +- valory/trader_abci:0.1.0:bafybeihu5n4xwdaedqyomdval4nmtmabq5azolynx2fo3xhmt7zurvmrwe - valory/staking_abci:0.1.0:bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u default_ledger: ethereum required_ledgers: diff --git a/packages/valory/contracts/transfer_nft_condition/__init__.py b/packages/valory/contracts/transfer_nft_condition/__init__.py index f3aad7986..d8773d74b 100644 --- a/packages/valory/contracts/transfer_nft_condition/__init__.py +++ b/packages/valory/contracts/transfer_nft_condition/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2023 Valory AG +# 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. diff --git a/packages/valory/contracts/transfer_nft_condition/contract.py b/packages/valory/contracts/transfer_nft_condition/contract.py index d6557185e..1fee90e96 100644 --- a/packages/valory/contracts/transfer_nft_condition/contract.py +++ b/packages/valory/contracts/transfer_nft_condition/contract.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2023 Valory AG +# 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. diff --git a/packages/valory/contracts/transfer_nft_condition/contract.yaml b/packages/valory/contracts/transfer_nft_condition/contract.yaml index 009d86de1..4930da6b0 100644 --- a/packages/valory/contracts/transfer_nft_condition/contract.yaml +++ b/packages/valory/contracts/transfer_nft_condition/contract.yaml @@ -7,9 +7,9 @@ license: Apache-2.0 aea_version: '>=1.0.0, <2.0.0' fingerprint: README.md: bafybeidiaep6cpoqlabnajvsgegpt72hqnbtozayicaxclzxzftopvlw5u - __init__.py: bafybeigr6fpkchrud5tjrx5qevyk436jufe4zt6otkpbzsiergvyp64hs4 + __init__.py: bafybeigz4j3ow7nagttswpbrpajnxqtxrl35oznejzxwi6bhfdeltnab5i build/TransferNFTCondition.json: bafybeicovauoyn5bulnmz3ulkee56s46viemw3vpy7fk3zi4isol2jkdca - contract.py: bafybeig2wfwtn6kmdozoenxt3hp23srgpeebq4zyaxboqbs5em3rooordm + contract.py: bafybeiamwqz5tln7xknhoogsev36c3vhi4u4aovbwmowvpavhmzbtp7ywy fingerprint_ignore_patterns: [] contracts: [] class_name: TransferNftCondition diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index 80bcd3930..4124d7581 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeiddrqraqzfxbtx6zhnwk4kjfw5bkghb4ikudn3ohqgwnrlmxkweda +agent: valory/trader:0.1.0:bafybeie3uyvnz6ql7niru5e34xe4ncxsa6i2kly5xsk6usc5g7xloxrmui number_of_agents: 4 deployment: {} --- diff --git a/packages/valory/skills/decision_maker_abci/behaviours/base.py b/packages/valory/skills/decision_maker_abci/behaviours/base.py index bd497e6af..8954e0596 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/base.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/base.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2023 Valory AG +# 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. diff --git a/packages/valory/skills/decision_maker_abci/behaviours/round_behaviour.py b/packages/valory/skills/decision_maker_abci/behaviours/round_behaviour.py index d8faca160..68e830ecb 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/round_behaviour.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/round_behaviour.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2023 Valory AG +# 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. diff --git a/packages/valory/skills/decision_maker_abci/models.py b/packages/valory/skills/decision_maker_abci/models.py index 7ce355b61..1f01626dc 100644 --- a/packages/valory/skills/decision_maker_abci/models.py +++ b/packages/valory/skills/decision_maker_abci/models.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2023 Valory AG +# 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. diff --git a/packages/valory/skills/decision_maker_abci/payloads.py b/packages/valory/skills/decision_maker_abci/payloads.py index 08a9908cd..3790df766 100644 --- a/packages/valory/skills/decision_maker_abci/payloads.py +++ b/packages/valory/skills/decision_maker_abci/payloads.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2023 Valory AG +# 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. diff --git a/packages/valory/skills/decision_maker_abci/rounds.py b/packages/valory/skills/decision_maker_abci/rounds.py index 3961ed8a1..a38a2b03e 100644 --- a/packages/valory/skills/decision_maker_abci/rounds.py +++ b/packages/valory/skills/decision_maker_abci/rounds.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2023 Valory AG +# 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. diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index fd33dbe50..210c41055 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -12,7 +12,7 @@ fingerprint: README.md: bafybeia367zzdwndvlhw27rvnwodytjo3ms7gbc3q7mhrrjqjgfasnk47i __init__.py: bafybeih563ujnigeci2ldzh7hakbau6a222vsed7leg3b7lq32vcn3nm4a behaviours/__init__.py: bafybeih6ddz2ocvm6x6ytvlbcz6oi4snb5ee5xh5h65nq4w2qf7fd7zfky - behaviours/base.py: bafybeieuyh6mbmvcjpwzwdoo6caop5gappqiz6sr3tbfxi2lobxol6cauq + behaviours/base.py: bafybeifwwlcsjtcqog3natigcrsyakkfmndhtka4aq7whubo2c6p7to6li behaviours/bet_placement.py: bafybeigtz4uimsqjjwq4r5p3a5v6niqdtqezbuf2ghy6o7syhsh4k5gjfa behaviours/blacklisting.py: bafybeierwdzn6vav54l6zym77hhx2vdx3jtnnwpbhwmwwyrqzncwjwkxu4 behaviours/claim_subscription.py: bafybeihctnttpg5ckv5653iqwidbfxqif3ox35zwuaf52wfjfmpgtxv7em @@ -21,7 +21,7 @@ fingerprint: behaviours/handle_failed_tx.py: bafybeidxpc6u575ymct5tdwutvzov6zqfdoio5irgldn3fw7q3lg36mmxm behaviours/order_subscription.py: bafybeiehmurti6cmarlaqqgr45fou6js5gb4cbbul7n36chyb4ks3jxtay behaviours/reedem.py: bafybeibenzbek5qdtk3gobjxfmsm6tg6i3d4yltozymy23izpgbcpal5ye - behaviours/round_behaviour.py: bafybeicbvfc622elfkzag2xb3rnqvajg246izdpo5x5yvz22zv3vylbzc4 + behaviours/round_behaviour.py: bafybeidyhaolxdwkgpuit6t2kkrpwnkyrtsp7lyltz47t3ztxasz4esy5y behaviours/sampling.py: bafybeifzhm4sspdvt227ksl5hjn26offgqpwempgbcwbr6dq7gyi2a46sm behaviours/tool_selection.py: bafybeifpvrrbftlkjsoiysnasihzttousk6hxnukzrln6z2d33e3zexkje dialogues.py: bafybeigpwuzku3we7axmxeamg7vn656maww6emuztau5pg3ebsoquyfdqm @@ -29,21 +29,21 @@ fingerprint: handlers.py: bafybeiggoetspwcvdojmbjdd67tmkoeedikmt6vsbcium3zjaljb6jzqu4 io_/__init__.py: bafybeifxgmmwjqzezzn3e6keh2bfo4cyo7y5dq2ept3stfmgglbrzfl5rq io_/loader.py: bafybeih3sdsx5dhe4kzhtoafexjgkutsujwqy3zcdrlrkhtdks45bc7exa - models.py: bafybeiay4dda2v2ywivkzolcexygd7bmju4imjtvolpk2ugq6jjqjnsjjm - payloads.py: bafybeiawjiqmqtp2tchpz3cojxlujrohly67me3q4shy2asu3nruq2ys6q + models.py: bafybeihyhlmwjn5vkle2pu2yqynlqeuontmnl27idyba6hcscxqgjw2424 + payloads.py: bafybeibmjrckgsflqulviynadl6bx3keuabvhfolkiib7cmjhfsov2vuty policy.py: bafybeidpmx4ek3qze63zpuwixyf6t7bdv62ewgkzt3ljrzadiwdw64cueq redeem_info.py: bafybeifiiix4gihfo4avraxt34sfw35v6dqq45do2drrssei2shbps63mm - rounds.py: bafybeigqnbpztzycfiud44d37kthdo7d6rysxxhwkn5suzlmqgdekgqwja + rounds.py: bafybeiebdxua5awzexnxl66vj3ydqubiuim2cj4ucq4fnp42q3qxoquia4 states/__init__.py: bafybeid23llnyp6j257dluxmrnztugo5llsrog7kua53hllyktz4dqhqoy - states/base.py: bafybeib3y5pmt52i747wxpnc7spwbrqim32vgju5ln46e22h4qvowhysom + states/base.py: bafybeifm5xld4fuboeygcnlxwsuduneqps6lgsbhmumqbt76kyya5pae3a states/bet_placement.py: bafybeibalhxhp2c4oljmiwqi6ds3g36fgtabmf42mb5sgq6z22znrcbhda states/blacklisting.py: bafybeifruvxwwltndwazkzzbpc5nnnad3z5t5ofy6d3i7nssljbxl6gvxu - states/claim_subscription.py: bafybeifcvvyib7eeeuj5nhhr7r4tj6b7jsy6c45vpsiekpzseac2g5ldca + states/claim_subscription.py: bafybeiampifhdoztggwj6gthl2hfzecmjcwnm6nic2o47q4je7j4x3ujne states/decision_receive.py: bafybeib3roo27nccj4eylaqwwzztzzzwsi6px5atjrch5wbqmpln2kyy6y states/decision_request.py: bafybeic7otc3hjb753svbmur3yyk6szahc25yii3x4w4vcnpfz6jwvacuu - states/final_states.py: bafybeieapzmpwkhoebcxpmhfkohwnxsh6gejnxzzsyzkx2os7bznhd33qu + states/final_states.py: bafybeidmlhpjvsdogejrvaczk3tfcbh7f7ijectshh23qi5yzktozzunee states/handle_failed_tx.py: bafybeihewm2vernvhktuorljdupjqcg2p5vs6wvsira2d62wkoyo5xlzjm - states/order_subscription.py: bafybeih7nucymipmbqjup2ckwdkzcj7aarxezhdgdkbtazx45wr3cmna34 + states/order_subscription.py: bafybeiaoemltuh3zkch7hvaxzxxsofe3pomlgifj5hamkqqon5mg5eaoqq states/redeem.py: bafybeiblidmpt73ocac73wmakusrnf5267vs7s2foc5pqkrz4vuqgy3b4u states/sampling.py: bafybeidnvdogjlthjfe7jpaiuezm3xydrbxxukyoss4gx6t5fdin52rsta states/tool_selection.py: bafybeiaaijv6dukp3bmsptcwkcmumc6wu6ztzkvaqzsqqjbfn4ozgyuykq @@ -65,7 +65,7 @@ contracts: - valory/realitio:0.1.0:bafybeic5ie4oodetj4krdogydvbfxg4qggc3matpiflocah626tpevpreq - valory/realitio_proxy:0.1.0:bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4 - valory/agent_registry:0.1.0:bafybeib5czj6b3q6cukykbddo2nmn7etgmle53erq7ucapz5o7dzunno4a -- valory/transfer_nft_condition:0.1.0:bafybeihpwr5kdm6rhqwbnarhuao3nw45g65v47n53iap5werejuri3f2c4 +- valory/transfer_nft_condition:0.1.0:bafybeihoeso5lhptekpvsrt77dxenyl2te45ujl7llyeaf2uv22affghre protocols: - valory/contract_api:1.0.0:bafybeialhbjvwiwcnqq3ysxcyemobcbie7xza66gaofcvla5njezkvhcka - valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru diff --git a/packages/valory/skills/decision_maker_abci/states/base.py b/packages/valory/skills/decision_maker_abci/states/base.py index ce28c63a6..16b8c8d8b 100644 --- a/packages/valory/skills/decision_maker_abci/states/base.py +++ b/packages/valory/skills/decision_maker_abci/states/base.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2023 Valory AG +# 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. diff --git a/packages/valory/skills/decision_maker_abci/states/claim_subscription.py b/packages/valory/skills/decision_maker_abci/states/claim_subscription.py index 307b8f20c..53b41baf2 100644 --- a/packages/valory/skills/decision_maker_abci/states/claim_subscription.py +++ b/packages/valory/skills/decision_maker_abci/states/claim_subscription.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2023 Valory AG +# 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. diff --git a/packages/valory/skills/decision_maker_abci/states/final_states.py b/packages/valory/skills/decision_maker_abci/states/final_states.py index d105104a6..4339bc69d 100644 --- a/packages/valory/skills/decision_maker_abci/states/final_states.py +++ b/packages/valory/skills/decision_maker_abci/states/final_states.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2023 Valory AG +# 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. diff --git a/packages/valory/skills/decision_maker_abci/states/order_subscription.py b/packages/valory/skills/decision_maker_abci/states/order_subscription.py index 7d2c3798f..975b61e33 100644 --- a/packages/valory/skills/decision_maker_abci/states/order_subscription.py +++ b/packages/valory/skills/decision_maker_abci/states/order_subscription.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2023 Valory AG +# 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. diff --git a/packages/valory/skills/trader_abci/composition.py b/packages/valory/skills/trader_abci/composition.py index 933b24f94..1d4a1f10f 100644 --- a/packages/valory/skills/trader_abci/composition.py +++ b/packages/valory/skills/trader_abci/composition.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2023 Valory AG +# 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. diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index fdbabd408..45e6e1f45 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -9,7 +9,7 @@ fingerprint: README.md: bafybeiab4xgadptz4mhvno4p6xvkh7p4peg7iuhotabydriu74dmj6ljga __init__.py: bafybeido7wa33h4dtleap57vzgyb4fsofk4vindsqcekyfo5i56i2rll2a behaviours.py: bafybeieesrefrpo5c5upzztgm5fwfrmxeagilacuau5nacobhsfvgpbzby - composition.py: bafybeigokvn3xg2zju7gfiqydoonizxuxnwkoqkssglg4lgoymv2tnci74 + composition.py: bafybeif75v3swf2pmxi3rdd5kqdfv4ap5uapcbszkiohhur67oemrgotay dialogues.py: bafybeiebofyykseqp3fmif36cqmmyf3k7d2zbocpl6t6wnlpv4szghrxbm fsm_specification.yaml: bafybeib3ycl5bjo5uilyaly7uoovvc3b3gpjrkuvdos5ffsgmrs73j6bkm handlers.py: bafybeibkiqwe7hoqccjirimd44nzeqkabc7oo74romqklssion27s5sa2a @@ -25,8 +25,8 @@ skills: - valory/transaction_settlement_abci:0.1.0:bafybeidsfwslnbhhhplvgteeec7idrhm7gxpay4f36wwnkgl4mh7ogovke - valory/termination_abci:0.1.0:bafybeid5ipudhwuiuhbzvpn4usgdm3a3ow3naafuefvetmgbbcy6ugyuwi - valory/market_manager_abci:0.1.0:bafybeicqjiqq63bcb6colaq4adwsn7o6zhyd7n5ftwdv4kvt3rqxhnapw4 -- valory/decision_maker_abci:0.1.0:bafybeibnmgkfw56qdgcjrziyqulxzedb5p5jjjwaam7annf4tkgjwohrze -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeicnn2e7muwanfm7frkfod66vuqqbdj7dta6wryqalv4xzo7tr2viq +- valory/decision_maker_abci:0.1.0:bafybeie4yoxb3icc4uqp3h7aaq2nvdjkn4osalgeboxrb6v7igtzns6jjy +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeiapmnedhjbk7k3wfmgclkumkzepgavxkemlyhxbgoh7n2xghlvuom - valory/staking_abci:0.1.0:bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u behaviours: main: diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/rounds.py b/packages/valory/skills/tx_settlement_multiplexer_abci/rounds.py index 4b66e93e1..a66fa55dd 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/rounds.py +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/rounds.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2023 Valory AG +# 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. diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index dbee56e99..a3323eba1 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -13,7 +13,7 @@ fingerprint: fsm_specification.yaml: bafybeidwxjna36auqbtqlehx73kyb6o74suhzj5bothgtiapcj35b7gzve handlers.py: bafybeiafbqr7ojfcbwohvee7x4zzswad3ymfrrbjlfz7uuuttmn3qdfs6q models.py: bafybeigtmxoecoow663hgqnyinxarlrttyyt5ghpbdamdv4tc4kikcfx3a - rounds.py: bafybeidqmmhwsvkoijlh52faliyw2pibyb4zg2fhx2to7uaioja5b7hcjy + rounds.py: bafybeiaeb5qdt7pgd3k63fxrnmbhwz5tv6vjbazlb6jwxpjflusdepsowm fingerprint_ignore_patterns: [] connections: [] contracts: [] @@ -21,7 +21,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru skills: - valory/abstract_round_abci:0.1.0:bafybeidbmd2cgffqqfwsyxws5dffsc6nbt5ijgkbhyzse5i42yddmwqlpy -- valory/decision_maker_abci:0.1.0:bafybeibnmgkfw56qdgcjrziyqulxzedb5p5jjjwaam7annf4tkgjwohrze +- valory/decision_maker_abci:0.1.0:bafybeie4yoxb3icc4uqp3h7aaq2nvdjkn4osalgeboxrb6v7igtzns6jjy - valory/staking_abci:0.1.0:bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u behaviours: main: From ff74c68f6f9f7052dedcfea586b5c447e801211c Mon Sep 17 00:00:00 2001 From: Ardian Date: Fri, 19 Jan 2024 13:00:29 +0100 Subject: [PATCH 09/12] chore: docstrings --- packages/packages.json | 10 +-- packages/valory/agents/trader/aea-config.yaml | 6 +- packages/valory/services/trader/service.yaml | 2 +- .../fsm_specification.yaml | 18 +++- .../skills/decision_maker_abci/rounds.py | 84 +++++++++++-------- .../skills/decision_maker_abci/skill.yaml | 4 +- .../skills/trader_abci/fsm_specification.yaml | 17 +++- packages/valory/skills/trader_abci/skill.yaml | 6 +- .../fsm_specification.yaml | 4 + .../tx_settlement_multiplexer_abci/rounds.py | 16 ++-- .../tx_settlement_multiplexer_abci/skill.yaml | 6 +- 11 files changed, 111 insertions(+), 62 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index 83090e639..88eab04e4 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -1,13 +1,13 @@ { "dev": { "skill/valory/market_manager_abci/0.1.0": "bafybeicqjiqq63bcb6colaq4adwsn7o6zhyd7n5ftwdv4kvt3rqxhnapw4", - "skill/valory/decision_maker_abci/0.1.0": "bafybeie4yoxb3icc4uqp3h7aaq2nvdjkn4osalgeboxrb6v7igtzns6jjy", - "skill/valory/trader_abci/0.1.0": "bafybeihu5n4xwdaedqyomdval4nmtmabq5azolynx2fo3xhmt7zurvmrwe", + "skill/valory/decision_maker_abci/0.1.0": "bafybeicfehnkzhnqjii5jyfunsizvcrj7ycs7hdt42ie3m7adatykowlve", + "skill/valory/trader_abci/0.1.0": "bafybeibllgvqa23lghfgjd5uzbv3doq2ssro4ppgxasdx4ifizfitwskrq", "contract/valory/market_maker/0.1.0": "bafybeihcueo3ct3h5fqyrwsjeofr5winyxlnegnwdvofopwhrfzkhgpxte", - "agent/valory/trader/0.1.0": "bafybeie3uyvnz6ql7niru5e34xe4ncxsa6i2kly5xsk6usc5g7xloxrmui", - "service/valory/trader/0.1.0": "bafybeib7jkhdtmsekjr6nzkm4u7rw3p7ejx2uc7srxgnujezttxsmwqsoi", + "agent/valory/trader/0.1.0": "bafybeic7vht4y3i6dsdzksi27gkkfuwpycqix5mjhzcvsomwvo2u3t2zty", + "service/valory/trader/0.1.0": "bafybeidavmownt27j6drh5exwxd6udvdmyt4e54gwxuqiumpo7epxkqsga", "contract/valory/erc20/0.1.0": "bafybeiecuaahlywb2rw6s76av5rdqg4gad6j753to6aqrix7zmbbt6kj6q", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeiapmnedhjbk7k3wfmgclkumkzepgavxkemlyhxbgoh7n2xghlvuom", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeih642rgpt35bf5e73vdt3ecbleuihvfgyqbdpo7prt6ljhnzagagm", "contract/valory/mech/0.1.0": "bafybeigmkbovcb6wcfqkkmmryo6kzqsai5qq325lzmsvtlxe4fn6rcmwoy", "contract/valory/realitio/0.1.0": "bafybeic5ie4oodetj4krdogydvbfxg4qggc3matpiflocah626tpevpreq", "contract/valory/realitio_proxy/0.1.0": "bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4", diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index c21e4e1a2..f0da9d0a8 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -44,10 +44,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeida6w2afp4m3dvnbkbwxz67ozjlry3wpsbkxwz7usalm3o2ghy46u - valory/termination_abci:0.1.0:bafybeid5ipudhwuiuhbzvpn4usgdm3a3ow3naafuefvetmgbbcy6ugyuwi - valory/transaction_settlement_abci:0.1.0:bafybeidsfwslnbhhhplvgteeec7idrhm7gxpay4f36wwnkgl4mh7ogovke -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeiapmnedhjbk7k3wfmgclkumkzepgavxkemlyhxbgoh7n2xghlvuom +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeih642rgpt35bf5e73vdt3ecbleuihvfgyqbdpo7prt6ljhnzagagm - valory/market_manager_abci:0.1.0:bafybeicqjiqq63bcb6colaq4adwsn7o6zhyd7n5ftwdv4kvt3rqxhnapw4 -- valory/decision_maker_abci:0.1.0:bafybeie4yoxb3icc4uqp3h7aaq2nvdjkn4osalgeboxrb6v7igtzns6jjy -- valory/trader_abci:0.1.0:bafybeihu5n4xwdaedqyomdval4nmtmabq5azolynx2fo3xhmt7zurvmrwe +- valory/decision_maker_abci:0.1.0:bafybeicfehnkzhnqjii5jyfunsizvcrj7ycs7hdt42ie3m7adatykowlve +- valory/trader_abci:0.1.0:bafybeibllgvqa23lghfgjd5uzbv3doq2ssro4ppgxasdx4ifizfitwskrq - valory/staking_abci:0.1.0:bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u default_ledger: ethereum required_ledgers: diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index 4124d7581..db82b5771 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeie3uyvnz6ql7niru5e34xe4ncxsa6i2kly5xsk6usc5g7xloxrmui +agent: valory/trader:0.1.0:bafybeic7vht4y3i6dsdzksi27gkkfuwpycqix5mjhzcvsomwvo2u3t2zty number_of_agents: 4 deployment: {} --- diff --git a/packages/valory/skills/decision_maker_abci/fsm_specification.yaml b/packages/valory/skills/decision_maker_abci/fsm_specification.yaml index 68dca3de7..47153c41e 100644 --- a/packages/valory/skills/decision_maker_abci/fsm_specification.yaml +++ b/packages/valory/skills/decision_maker_abci/fsm_specification.yaml @@ -8,20 +8,24 @@ alphabet_in: - NO_MAJORITY - NO_OP - NO_REDEEMING +- NO_SUBSCRIPTION - REDEEM_ROUND_TIMEOUT - ROUND_TIMEOUT - SLOTS_UNSUPPORTED_ERROR +- SUBSCRIPTION_ERROR - TIE - UNPROFITABLE default_start_state: SamplingRound final_states: - FinishedDecisionMakerRound +- FinishedSubscriptionRound - FinishedWithoutDecisionRound - FinishedWithoutRedeemingRound - ImpossibleRound - RefillRequiredRound label: DecisionMakerAbciApp start_states: +- ClaimRound - DecisionReceiveRound - HandleFailedTxRound - RedeemRound @@ -29,9 +33,11 @@ start_states: states: - BetPlacementRound - BlacklistingRound +- ClaimRound - DecisionReceiveRound - DecisionRequestRound - FinishedDecisionMakerRound +- FinishedSubscriptionRound - FinishedWithoutDecisionRound - FinishedWithoutRedeemingRound - HandleFailedTxRound @@ -39,6 +45,7 @@ states: - RedeemRound - RefillRequiredRound - SamplingRound +- SubscriptionRound - ToolSelectionRound transition_func: (BetPlacementRound, DONE): FinishedDecisionMakerRound @@ -51,6 +58,10 @@ transition_func: (BlacklistingRound, NONE): ImpossibleRound (BlacklistingRound, NO_MAJORITY): BlacklistingRound (BlacklistingRound, ROUND_TIMEOUT): BlacklistingRound + (ClaimRound, DONE): ToolSelectionRound + (ClaimRound, NO_MAJORITY): ClaimRound + (ClaimRound, ROUND_TIMEOUT): ClaimRound + (ClaimRound, SUBSCRIPTION_ERROR): ClaimRound (DecisionReceiveRound, DONE): BetPlacementRound (DecisionReceiveRound, MECH_RESPONSE_ERROR): BlacklistingRound (DecisionReceiveRound, NO_MAJORITY): DecisionReceiveRound @@ -70,10 +81,15 @@ transition_func: (RedeemRound, NO_MAJORITY): RedeemRound (RedeemRound, NO_REDEEMING): FinishedWithoutRedeemingRound (RedeemRound, REDEEM_ROUND_TIMEOUT): FinishedWithoutRedeemingRound - (SamplingRound, DONE): ToolSelectionRound + (SamplingRound, DONE): SubscriptionRound (SamplingRound, NONE): FinishedWithoutDecisionRound (SamplingRound, NO_MAJORITY): SamplingRound (SamplingRound, ROUND_TIMEOUT): SamplingRound + (SubscriptionRound, DONE): FinishedSubscriptionRound + (SubscriptionRound, NO_MAJORITY): SubscriptionRound + (SubscriptionRound, NO_SUBSCRIPTION): ToolSelectionRound + (SubscriptionRound, ROUND_TIMEOUT): SubscriptionRound + (SubscriptionRound, SUBSCRIPTION_ERROR): SubscriptionRound (ToolSelectionRound, DONE): DecisionRequestRound (ToolSelectionRound, NONE): ToolSelectionRound (ToolSelectionRound, NO_MAJORITY): ToolSelectionRound diff --git a/packages/valory/skills/decision_maker_abci/rounds.py b/packages/valory/skills/decision_maker_abci/rounds.py index a38a2b03e..036e81cb1 100644 --- a/packages/valory/skills/decision_maker_abci/rounds.py +++ b/packages/valory/skills/decision_maker_abci/rounds.py @@ -75,61 +75,73 @@ class DecisionMakerAbciApp(AbciApp[Event]): Initial round: SamplingRound - Initial states: {DecisionReceiveRound, HandleFailedTxRound, RedeemRound, SamplingRound} + Initial states: {ClaimRound, DecisionReceiveRound, HandleFailedTxRound, RedeemRound, SamplingRound} Transition states: 0. SamplingRound - done: 1. - - none: 9. + - none: 11. - no majority: 0. - round timeout: 0. - 1. ToolSelectionRound - - done: 2. - - none: 1. + 1. SubscriptionRound + - done: 13. + - no subscription: 3. + - subscription error: 1. - no majority: 1. - round timeout: 1. - 2. DecisionRequestRound - - done: 8. - - slots unsupported error: 4. + 2. ClaimRound + - done: 3. + - subscription error: 2. - no majority: 2. - round timeout: 2. - - none: 12. - 3. DecisionReceiveRound - - done: 5. - - mech response error: 4. + 3. ToolSelectionRound + - done: 4. + - none: 3. - no majority: 3. - - tie: 4. - - unprofitable: 4. - round timeout: 3. - 4. BlacklistingRound - - done: 9. - - none: 12. + 4. DecisionRequestRound + - done: 10. + - slots unsupported error: 6. - no majority: 4. - round timeout: 4. - - fetch error: 12. - 5. BetPlacementRound - - done: 8. - - insufficient balance: 11. + - none: 15. + 5. DecisionReceiveRound + - done: 7. + - mech response error: 6. - no majority: 5. + - tie: 6. + - unprofitable: 6. - round timeout: 5. - - none: 12. - 6. RedeemRound - - done: 8. - - no redeeming: 10. + 6. BlacklistingRound + - done: 11. + - none: 15. - no majority: 6. - - redeem round timeout: 10. - - none: 12. - 7. HandleFailedTxRound - - blacklist: 4. - - no op: 6. + - round timeout: 6. + - fetch error: 15. + 7. BetPlacementRound + - done: 10. + - insufficient balance: 14. - no majority: 7. - 8. FinishedDecisionMakerRound - 9. FinishedWithoutDecisionRound - 10. FinishedWithoutRedeemingRound - 11. RefillRequiredRound - 12. ImpossibleRound + - round timeout: 7. + - none: 15. + 8. RedeemRound + - done: 10. + - no redeeming: 12. + - no majority: 8. + - redeem round timeout: 12. + - none: 15. + 9. HandleFailedTxRound + - blacklist: 6. + - no op: 8. + - no majority: 9. + 10. FinishedDecisionMakerRound + 11. FinishedWithoutDecisionRound + 12. FinishedWithoutRedeemingRound + 13. FinishedSubscriptionRound + 14. RefillRequiredRound + 15. ImpossibleRound - Final states: {FinishedDecisionMakerRound, FinishedWithoutDecisionRound, FinishedWithoutRedeemingRound, ImpossibleRound, RefillRequiredRound} + Final states: {FinishedDecisionMakerRound, FinishedSubscriptionRound, FinishedWithoutDecisionRound, FinishedWithoutRedeemingRound, ImpossibleRound, RefillRequiredRound} Timeouts: round timeout: 30.0 diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index 210c41055..d9df6a32c 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -25,7 +25,7 @@ fingerprint: behaviours/sampling.py: bafybeifzhm4sspdvt227ksl5hjn26offgqpwempgbcwbr6dq7gyi2a46sm behaviours/tool_selection.py: bafybeifpvrrbftlkjsoiysnasihzttousk6hxnukzrln6z2d33e3zexkje dialogues.py: bafybeigpwuzku3we7axmxeamg7vn656maww6emuztau5pg3ebsoquyfdqm - fsm_specification.yaml: bafybeidqrxj3l3e555znk4wxx6spwaijz3bhc5yialhzbhd6ngk52w7jbq + fsm_specification.yaml: bafybeifqxnqfxhrai4cpgiwbko6dvrelyhk2ztvbon52nko2jkujdecudq handlers.py: bafybeiggoetspwcvdojmbjdd67tmkoeedikmt6vsbcium3zjaljb6jzqu4 io_/__init__.py: bafybeifxgmmwjqzezzn3e6keh2bfo4cyo7y5dq2ept3stfmgglbrzfl5rq io_/loader.py: bafybeih3sdsx5dhe4kzhtoafexjgkutsujwqy3zcdrlrkhtdks45bc7exa @@ -33,7 +33,7 @@ fingerprint: payloads.py: bafybeibmjrckgsflqulviynadl6bx3keuabvhfolkiib7cmjhfsov2vuty policy.py: bafybeidpmx4ek3qze63zpuwixyf6t7bdv62ewgkzt3ljrzadiwdw64cueq redeem_info.py: bafybeifiiix4gihfo4avraxt34sfw35v6dqq45do2drrssei2shbps63mm - rounds.py: bafybeiebdxua5awzexnxl66vj3ydqubiuim2cj4ucq4fnp42q3qxoquia4 + rounds.py: bafybeidnjqh62pfjs55pdtm2vz4qds5zqiql52d3fbdrdaasgjjummi67a states/__init__.py: bafybeid23llnyp6j257dluxmrnztugo5llsrog7kua53hllyktz4dqhqoy states/base.py: bafybeifm5xld4fuboeygcnlxwsuduneqps6lgsbhmumqbt76kyya5pae3a states/bet_placement.py: bafybeibalhxhp2c4oljmiwqi6ds3g36fgtabmf42mb5sgq6z22znrcbhda diff --git a/packages/valory/skills/trader_abci/fsm_specification.yaml b/packages/valory/skills/trader_abci/fsm_specification.yaml index 889ab6efb..3a9228eef 100644 --- a/packages/valory/skills/trader_abci/fsm_specification.yaml +++ b/packages/valory/skills/trader_abci/fsm_specification.yaml @@ -20,6 +20,7 @@ alphabet_in: - NO_MAJORITY - NO_OP - NO_REDEEMING +- NO_SUBSCRIPTION - REDEEMING_DONE - REDEEM_ROUND_TIMEOUT - REFILL_REQUIRED @@ -29,6 +30,8 @@ alphabet_in: - SERVICE_NOT_STAKED - SLOTS_UNSUPPORTED_ERROR - STAKING_DONE +- SUBSCRIPTION_DONE +- SUBSCRIPTION_ERROR - SUSPICIOUS_ACTIVITY - TIE - UNPROFITABLE @@ -48,6 +51,7 @@ states: - CallCheckpointRound - CheckLateTxHashesRound - CheckTransactionHistoryRound +- ClaimRound - CollectSignatureRound - DecisionReceiveRound - DecisionRequestRound @@ -67,6 +71,7 @@ states: - SelectKeeperTransactionSubmissionARound - SelectKeeperTransactionSubmissionBAfterTimeoutRound - SelectKeeperTransactionSubmissionBRound +- SubscriptionRound - SynchronizeLateMessagesRound - ToolSelectionRound - UpdateBetsRound @@ -99,6 +104,10 @@ transition_func: (CheckTransactionHistoryRound, NEGATIVE): SelectKeeperTransactionSubmissionBRound (CheckTransactionHistoryRound, NONE): HandleFailedTxRound (CheckTransactionHistoryRound, NO_MAJORITY): CheckTransactionHistoryRound + (ClaimRound, DONE): ToolSelectionRound + (ClaimRound, NO_MAJORITY): ClaimRound + (ClaimRound, ROUND_TIMEOUT): ClaimRound + (ClaimRound, SUBSCRIPTION_ERROR): ClaimRound (CollectSignatureRound, DONE): FinalizationRound (CollectSignatureRound, NO_MAJORITY): ResetRound (CollectSignatureRound, ROUND_TIMEOUT): CollectSignatureRound @@ -127,6 +136,7 @@ transition_func: (PostTxSettlementRound, REDEEMING_DONE): CallCheckpointRound (PostTxSettlementRound, ROUND_TIMEOUT): PostTxSettlementRound (PostTxSettlementRound, STAKING_DONE): ResetAndPauseRound + (PostTxSettlementRound, SUBSCRIPTION_DONE): ClaimRound (PostTxSettlementRound, UNRECOGNIZED): FailedMultiplexerRound (PreTxSettlementRound, CHECKS_PASSED): RandomnessTransactionSubmissionRound (PreTxSettlementRound, NO_MAJORITY): PreTxSettlementRound @@ -149,7 +159,7 @@ transition_func: (ResetRound, DONE): RandomnessTransactionSubmissionRound (ResetRound, NO_MAJORITY): HandleFailedTxRound (ResetRound, RESET_TIMEOUT): HandleFailedTxRound - (SamplingRound, DONE): ToolSelectionRound + (SamplingRound, DONE): SubscriptionRound (SamplingRound, NONE): RedeemRound (SamplingRound, NO_MAJORITY): SamplingRound (SamplingRound, ROUND_TIMEOUT): SamplingRound @@ -167,6 +177,11 @@ transition_func: (SelectKeeperTransactionSubmissionBRound, INCORRECT_SERIALIZATION): HandleFailedTxRound (SelectKeeperTransactionSubmissionBRound, NO_MAJORITY): ResetRound (SelectKeeperTransactionSubmissionBRound, ROUND_TIMEOUT): SelectKeeperTransactionSubmissionBRound + (SubscriptionRound, DONE): PreTxSettlementRound + (SubscriptionRound, NO_MAJORITY): SubscriptionRound + (SubscriptionRound, NO_SUBSCRIPTION): ToolSelectionRound + (SubscriptionRound, ROUND_TIMEOUT): SubscriptionRound + (SubscriptionRound, SUBSCRIPTION_ERROR): SubscriptionRound (SynchronizeLateMessagesRound, DONE): CheckLateTxHashesRound (SynchronizeLateMessagesRound, NONE): SelectKeeperTransactionSubmissionBRound (SynchronizeLateMessagesRound, ROUND_TIMEOUT): SynchronizeLateMessagesRound diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index 45e6e1f45..f09b769e5 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -11,7 +11,7 @@ fingerprint: behaviours.py: bafybeieesrefrpo5c5upzztgm5fwfrmxeagilacuau5nacobhsfvgpbzby composition.py: bafybeif75v3swf2pmxi3rdd5kqdfv4ap5uapcbszkiohhur67oemrgotay dialogues.py: bafybeiebofyykseqp3fmif36cqmmyf3k7d2zbocpl6t6wnlpv4szghrxbm - fsm_specification.yaml: bafybeib3ycl5bjo5uilyaly7uoovvc3b3gpjrkuvdos5ffsgmrs73j6bkm + fsm_specification.yaml: bafybeif4dheianawotftdox6ysx7y62xl2ysxnlf2jr3al44jjiuzgxzuy handlers.py: bafybeibkiqwe7hoqccjirimd44nzeqkabc7oo74romqklssion27s5sa2a models.py: bafybeibrxivgpzamfmrl6bdngi67g72i32lmu5vgdn3jbwka265blk7ire fingerprint_ignore_patterns: [] @@ -25,8 +25,8 @@ skills: - valory/transaction_settlement_abci:0.1.0:bafybeidsfwslnbhhhplvgteeec7idrhm7gxpay4f36wwnkgl4mh7ogovke - valory/termination_abci:0.1.0:bafybeid5ipudhwuiuhbzvpn4usgdm3a3ow3naafuefvetmgbbcy6ugyuwi - valory/market_manager_abci:0.1.0:bafybeicqjiqq63bcb6colaq4adwsn7o6zhyd7n5ftwdv4kvt3rqxhnapw4 -- valory/decision_maker_abci:0.1.0:bafybeie4yoxb3icc4uqp3h7aaq2nvdjkn4osalgeboxrb6v7igtzns6jjy -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeiapmnedhjbk7k3wfmgclkumkzepgavxkemlyhxbgoh7n2xghlvuom +- valory/decision_maker_abci:0.1.0:bafybeicfehnkzhnqjii5jyfunsizvcrj7ycs7hdt42ie3m7adatykowlve +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeih642rgpt35bf5e73vdt3ecbleuihvfgyqbdpo7prt6ljhnzagagm - valory/staking_abci:0.1.0:bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u behaviours: main: diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/fsm_specification.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/fsm_specification.yaml index 28be80054..5070c9adf 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/fsm_specification.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/fsm_specification.yaml @@ -7,6 +7,7 @@ alphabet_in: - REFILL_REQUIRED - ROUND_TIMEOUT - STAKING_DONE +- SUBSCRIPTION_DONE - UNRECOGNIZED default_start_state: PreTxSettlementRound final_states: @@ -16,6 +17,7 @@ final_states: - FinishedDecisionRequestTxRound - FinishedRedeemingTxRound - FinishedStakingTxRound +- FinishedSubscriptionTxRound label: TxSettlementMultiplexerAbciApp start_states: - PostTxSettlementRound @@ -27,6 +29,7 @@ states: - FinishedDecisionRequestTxRound - FinishedRedeemingTxRound - FinishedStakingTxRound +- FinishedSubscriptionTxRound - PostTxSettlementRound - PreTxSettlementRound transition_func: @@ -35,6 +38,7 @@ transition_func: (PostTxSettlementRound, REDEEMING_DONE): FinishedRedeemingTxRound (PostTxSettlementRound, ROUND_TIMEOUT): PostTxSettlementRound (PostTxSettlementRound, STAKING_DONE): FinishedStakingTxRound + (PostTxSettlementRound, SUBSCRIPTION_DONE): FinishedSubscriptionTxRound (PostTxSettlementRound, UNRECOGNIZED): FailedMultiplexerRound (PreTxSettlementRound, CHECKS_PASSED): ChecksPassedRound (PreTxSettlementRound, NO_MAJORITY): PreTxSettlementRound diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/rounds.py b/packages/valory/skills/tx_settlement_multiplexer_abci/rounds.py index a66fa55dd..bbb4f9795 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/rounds.py +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/rounds.py @@ -156,18 +156,20 @@ class TxSettlementMultiplexerAbciApp(AbciApp[Event]): 1. PostTxSettlementRound - decision requesting done: 3. - bet placement done: 4. - - redeeming done: 5. - - staking done: 6. + - redeeming done: 6. + - staking done: 7. + - subscription done: 5. - round timeout: 1. - - unrecognized: 7. + - unrecognized: 8. 2. ChecksPassedRound 3. FinishedDecisionRequestTxRound 4. FinishedBetPlacementTxRound - 5. FinishedRedeemingTxRound - 6. FinishedStakingTxRound - 7. FailedMultiplexerRound + 5. FinishedSubscriptionTxRound + 6. FinishedRedeemingTxRound + 7. FinishedStakingTxRound + 8. FailedMultiplexerRound - Final states: {ChecksPassedRound, FailedMultiplexerRound, FinishedBetPlacementTxRound, FinishedDecisionRequestTxRound, FinishedRedeemingTxRound, FinishedStakingTxRound} + Final states: {ChecksPassedRound, FailedMultiplexerRound, FinishedBetPlacementTxRound, FinishedDecisionRequestTxRound, FinishedRedeemingTxRound, FinishedStakingTxRound, FinishedSubscriptionTxRound} Timeouts: round timeout: 30.0 diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index a3323eba1..98a7c41b6 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -10,10 +10,10 @@ fingerprint: __init__.py: bafybeide6k22zk4f3hyzhpapaoddsnxpw5elqcfvrxxj4nfvpzctv6jqhu behaviours.py: bafybeictumcqn2pgo7y2duemvzoaafognfhl6s6il3tv53hq66tf7xgpsu dialogues.py: bafybeiebofyykseqp3fmif36cqmmyf3k7d2zbocpl6t6wnlpv4szghrxbm - fsm_specification.yaml: bafybeidwxjna36auqbtqlehx73kyb6o74suhzj5bothgtiapcj35b7gzve + fsm_specification.yaml: bafybeib7nmznbbug6icxyahy34r6ory7ujkwnlakv3bgmnlecysr46l5v4 handlers.py: bafybeiafbqr7ojfcbwohvee7x4zzswad3ymfrrbjlfz7uuuttmn3qdfs6q models.py: bafybeigtmxoecoow663hgqnyinxarlrttyyt5ghpbdamdv4tc4kikcfx3a - rounds.py: bafybeiaeb5qdt7pgd3k63fxrnmbhwz5tv6vjbazlb6jwxpjflusdepsowm + rounds.py: bafybeictmmkmkxsbij4zhcsth6avb477tzhqaycpjkx2igtec2czszx6hu fingerprint_ignore_patterns: [] connections: [] contracts: [] @@ -21,7 +21,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru skills: - valory/abstract_round_abci:0.1.0:bafybeidbmd2cgffqqfwsyxws5dffsc6nbt5ijgkbhyzse5i42yddmwqlpy -- valory/decision_maker_abci:0.1.0:bafybeie4yoxb3icc4uqp3h7aaq2nvdjkn4osalgeboxrb6v7igtzns6jjy +- valory/decision_maker_abci:0.1.0:bafybeicfehnkzhnqjii5jyfunsizvcrj7ycs7hdt42ie3m7adatykowlve - valory/staking_abci:0.1.0:bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u behaviours: main: From 002a7675ba03df2d13e927aaa8cafff03640dcfd Mon Sep 17 00:00:00 2001 From: Ardian Date: Fri, 19 Jan 2024 13:17:09 +0100 Subject: [PATCH 10/12] chore: merge conflicts --- packages/packages.json | 26 ++++---- packages/valory/agents/trader/aea-config.yaml | 50 +++++++-------- .../transfer_nft_condition/contract.yaml | 4 +- packages/valory/services/trader/service.yaml | 2 +- .../skills/decision_maker_abci/skill.yaml | 64 +++++++++++-------- packages/valory/skills/trader_abci/skill.yaml | 22 +++---- .../tx_settlement_multiplexer_abci/skill.yaml | 12 ++-- 7 files changed, 94 insertions(+), 86 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index 7f7002658..b08db0a21 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -1,21 +1,21 @@ { "dev": { - "skill/valory/market_manager_abci/0.1.0": "bafybeicqjiqq63bcb6colaq4adwsn7o6zhyd7n5ftwdv4kvt3rqxhnapw4", - "skill/valory/decision_maker_abci/0.1.0": "bafybeicfehnkzhnqjii5jyfunsizvcrj7ycs7hdt42ie3m7adatykowlve", - "skill/valory/trader_abci/0.1.0": "bafybeibllgvqa23lghfgjd5uzbv3doq2ssro4ppgxasdx4ifizfitwskrq", - "contract/valory/market_maker/0.1.0": "bafybeihcueo3ct3h5fqyrwsjeofr5winyxlnegnwdvofopwhrfzkhgpxte", - "agent/valory/trader/0.1.0": "bafybeic7vht4y3i6dsdzksi27gkkfuwpycqix5mjhzcvsomwvo2u3t2zty", - "service/valory/trader/0.1.0": "bafybeidavmownt27j6drh5exwxd6udvdmyt4e54gwxuqiumpo7epxkqsga", - "contract/valory/erc20/0.1.0": "bafybeiecuaahlywb2rw6s76av5rdqg4gad6j753to6aqrix7zmbbt6kj6q", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeih642rgpt35bf5e73vdt3ecbleuihvfgyqbdpo7prt6ljhnzagagm", - "contract/valory/mech/0.1.0": "bafybeigmkbovcb6wcfqkkmmryo6kzqsai5qq325lzmsvtlxe4fn6rcmwoy", + "skill/valory/market_manager_abci/0.1.0": "bafybeif23nzty3mvhvx3tphgr3mdrfo4kadxzg4zi57at2pqvml5yrb2xa", + "skill/valory/decision_maker_abci/0.1.0": "bafybeigh24stox7axmwxv2smsalr5qyhvgccnn2x3vhzbuenspdoxit3ve", + "skill/valory/trader_abci/0.1.0": "bafybeicliiseobnghk6yux2sqhs3eb5swyz3eya5exoo3hi4crx7v7lirm", + "contract/valory/market_maker/0.1.0": "bafybeibgvm6jjrh26hvli3lqgi3xr7ihtjwu5pcbaeominq3w6zaksttle", + "agent/valory/trader/0.1.0": "bafybeia4m6fzzs6q5ggptchhczukj6rwy4bdtrjhhdubaw2wywzjrotktm", + "service/valory/trader/0.1.0": "bafybeiasxp5dxh7ddjdl74lbrtr55ebtgifrdc6vaxz5mlyk4dqhbyog54", + "contract/valory/erc20/0.1.0": "bafybeichh4vg3mav7pkv4nymw4wpnnyhd6lm2uzmjpcsrqetxi2x4g7b2m", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeicels3hbgxaq6b4acy4brwjcpvyw4vck6widrwrjy3h5imqrull4u", + "contract/valory/mech/0.1.0": "bafybeigbpvjbdnxwwxlee47thv2xuwxk4qte7k6yxzuv4qlczl5ecjh6ie", "contract/valory/realitio/0.1.0": "bafybeic5ie4oodetj4krdogydvbfxg4qggc3matpiflocah626tpevpreq", "contract/valory/realitio_proxy/0.1.0": "bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4", "contract/valory/conditional_tokens/0.1.0": "bafybeigucumqbsk74nj4rpm4p2cpiky4dj6uws7nfmgpimuviaxcamwqnu", - "contract/valory/agent_registry/0.1.0": "bafybeib5czj6b3q6cukykbddo2nmn7etgmle53erq7ucapz5o7dzunno4a", - "contract/valory/service_staking_token/0.1.0": "bafybeidhtmaaktcmg5j64e4btca4ngb67w7wjsecn55xcdcd6qmdg66ty4", - "skill/valory/staking_abci/0.1.0": "bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u", - "contract/valory/transfer_nft_condition/0.1.0": "bafybeihoeso5lhptekpvsrt77dxenyl2te45ujl7llyeaf2uv22affghre" + "contract/valory/agent_registry/0.1.0": "bafybeifdsvdensn52cngcwdcathmlu6vhsmzcljemfrb5uozsigzgwcvuy", + "contract/valory/service_staking_token/0.1.0": "bafybeidzvc43ijt3rhmsbfkymtrzq6xcyo6gutp6uradivxjknlkany6xi", + "skill/valory/staking_abci/0.1.0": "bafybeifflsc3m5pvxrbhih4xclslhpqdnryilp72wudqffvvttyiung76u", + "contract/valory/transfer_nft_condition/0.1.0": "bafybeig6j2tgy54mjpeqntrrcdzi32cogche57k4spsz6nz3yvouvb275u" }, "third_party": { "protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi", diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index 3e4b3e031..4845f7498 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -9,25 +9,25 @@ fingerprint: __init__.py: bafybeighcq4pmuzte6vhvvprrvo563vzghkoit2h6qdqxf2ma5bghevkee fingerprint_ignore_patterns: [] connections: -- valory/abci:0.1.0:bafybeiebojxskcarfxaq545xca3ylewmdnbsmgqzavss7ihbks4az7ifr4 -- valory/http_client:0.23.0:bafybeiddrfvomrmgvh5yuv2coq7ci72wcdf663stayi3m5aawnj4srggce -- valory/ipfs:0.1.0:bafybeidrfpktv4jwgjgpqdn3k63g7n3t46a7q2r2y6nn3icvpc2bu55jva -- valory/ledger:0.19.0:bafybeia47rr37ianvwsh77tjjpv3nwif5sywhhy2fbdshnz4a2icwln76a -- valory/p2p_libp2p_client:0.1.0:bafybeihge56dn3xep2dzomu7rtvbgo4uc2qqh7ljl3fubqdi2lq44gs5lq +- valory/abci:0.1.0:bafybeicmkbwcorbnv2aqf545anmbx6ouumh3kiqngqa7yue4vug7njzzpe +- valory/http_client:0.23.0:bafybeih5vzo22p2umhqo52nzluaanxx7kejvvpcpdsrdymckkyvmsim6gm +- valory/ipfs:0.1.0:bafybeifkrynw6jjg7bs7nw535m5bcrav5qab27vr5ktgfuvf65dpazc4ci +- valory/ledger:0.19.0:bafybeic3ft7l7ca3qgnderm4xupsfmyoihgi27ukotnz7b5hdczla2enya +- valory/p2p_libp2p_client:0.1.0:bafybeid3xg5k2ol5adflqloy75ibgljmol6xsvzvezebsg7oudxeeolz7e contracts: -- valory/gnosis_safe:0.1.0:bafybeic54u6jwqicav2xtkm6kfb3udjvxzufch5z3vwoloe72a7sjlhgua -- valory/gnosis_safe_proxy_factory:0.1.0:bafybeianp36eoydshddii7f2qkdqjfb47ghabdofbpa4f4wndde2cuctpa -- valory/service_registry:0.1.0:bafybeig5dejsuyezds7uqlkcm3xz2pvxamsjmsjidwpwjv6zkkuafz3ex4 -- valory/market_maker:0.1.0:bafybeihcueo3ct3h5fqyrwsjeofr5winyxlnegnwdvofopwhrfzkhgpxte -- valory/erc20:0.1.0:bafybeiecuaahlywb2rw6s76av5rdqg4gad6j753to6aqrix7zmbbt6kj6q +- valory/gnosis_safe:0.1.0:bafybeia53amnoc2py4io773sblsiy4woaebckiidbkvulow62crpocvbny +- valory/gnosis_safe_proxy_factory:0.1.0:bafybeidxg3y2rkgpqxvzmr6ydy7os2q6lijtsm5oec4k4lyx2olpa5mbfu +- valory/service_registry:0.1.0:bafybeicnseur5i5ue5md7eoep6pqedibgm6tzlrwrgoshwu4xvwcbd6jmi +- valory/market_maker:0.1.0:bafybeibgvm6jjrh26hvli3lqgi3xr7ihtjwu5pcbaeominq3w6zaksttle +- valory/erc20:0.1.0:bafybeichh4vg3mav7pkv4nymw4wpnnyhd6lm2uzmjpcsrqetxi2x4g7b2m - valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y -- valory/mech:0.1.0:bafybeigmkbovcb6wcfqkkmmryo6kzqsai5qq325lzmsvtlxe4fn6rcmwoy +- valory/mech:0.1.0:bafybeigbpvjbdnxwwxlee47thv2xuwxk4qte7k6yxzuv4qlczl5ecjh6ie - valory/conditional_tokens:0.1.0:bafybeigucumqbsk74nj4rpm4p2cpiky4dj6uws7nfmgpimuviaxcamwqnu - valory/realitio:0.1.0:bafybeic5ie4oodetj4krdogydvbfxg4qggc3matpiflocah626tpevpreq - valory/realitio_proxy:0.1.0:bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4 -- valory/agent_registry:0.1.0:bafybeib5czj6b3q6cukykbddo2nmn7etgmle53erq7ucapz5o7dzunno4a -- valory/service_staking_token:0.1.0:bafybeidhtmaaktcmg5j64e4btca4ngb67w7wjsecn55xcdcd6qmdg66ty4 -- valory/transfer_nft_condition:0.1.0:bafybeihoeso5lhptekpvsrt77dxenyl2te45ujl7llyeaf2uv22affghre +- valory/agent_registry:0.1.0:bafybeifdsvdensn52cngcwdcathmlu6vhsmzcljemfrb5uozsigzgwcvuy +- valory/service_staking_token:0.1.0:bafybeidzvc43ijt3rhmsbfkymtrzq6xcyo6gutp6uradivxjknlkany6xi +- valory/transfer_nft_condition:0.1.0:bafybeig6j2tgy54mjpeqntrrcdzi32cogche57k4spsz6nz3yvouvb275u protocols: - open_aea/signing:1.0.0:bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi - valory/abci:0.1.0:bafybeiaqmp7kocbfdboksayeqhkbrynvlfzsx4uy4x6nohywnmaig4an7u @@ -38,17 +38,17 @@ protocols: - valory/ledger_api:1.0.0:bafybeihdk6psr4guxmbcrc26jr2cbgzpd5aljkqvpwo64bvaz7tdti2oni - valory/tendermint:0.1.0:bafybeig4mi3vmlv5zpbjbfuzcgida6j5f2nhrpedxicmrrfjweqc5r7cra skills: -- valory/abstract_abci:0.1.0:bafybeigi7m5l6buucytkyu6rsz4rh7lj6wtvvgxxtn6uansj7lcxofvv5e -- valory/abstract_round_abci:0.1.0:bafybeidbmd2cgffqqfwsyxws5dffsc6nbt5ijgkbhyzse5i42yddmwqlpy -- valory/registration_abci:0.1.0:bafybeieylbkzk3zju6un3xysextycnj72aniq2britpvnniud4ekglcbbi -- valory/reset_pause_abci:0.1.0:bafybeida6w2afp4m3dvnbkbwxz67ozjlry3wpsbkxwz7usalm3o2ghy46u -- valory/termination_abci:0.1.0:bafybeid5ipudhwuiuhbzvpn4usgdm3a3ow3naafuefvetmgbbcy6ugyuwi -- valory/transaction_settlement_abci:0.1.0:bafybeidsfwslnbhhhplvgteeec7idrhm7gxpay4f36wwnkgl4mh7ogovke -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeia4je5sswi5djvrvlscbms5opten5uxzdcs64rysje4an4ylgitri -- valory/market_manager_abci:0.1.0:bafybeicqjiqq63bcb6colaq4adwsn7o6zhyd7n5ftwdv4kvt3rqxhnapw4 -- valory/decision_maker_abci:0.1.0:bafybeictykibll26pjydtfmg54hpyoebwx2linmiatohrwpgvd35lwmyha -- valory/trader_abci:0.1.0:bafybeigcnnr2dgdqofgcn2vxaqigek2qbytparxvryzjndxrpk4vovpnra -- valory/staking_abci:0.1.0:bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u +- valory/abstract_abci:0.1.0:bafybeibqqfgtjdfbvexjw6v4zasz5l6ssnw6joqgookfgpia2qqhvkt33e +- valory/abstract_round_abci:0.1.0:bafybeibna634t4w4udainzsuxwfydkbcy33alcqy6ugalcfuhoyhr53gs4 +- valory/registration_abci:0.1.0:bafybeifvglcgcyla5abdth4htjxbom7vidzytk5pfjfnslpbxox2cyjxse +- valory/reset_pause_abci:0.1.0:bafybeigkf7uh6zre3wc3btm2we7xffls4e4vurvtsou2nswbn6mcc3g52a +- valory/termination_abci:0.1.0:bafybeif7dwj4i5okp7rsyeiyvnmt5xop7njvj27bmjqdx4skmimqls7t4e +- valory/transaction_settlement_abci:0.1.0:bafybeic3ysdc46z4ipuonc2g6vdyqaxxljvfd45cflzi2xq7o7hre6lvvy +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeicels3hbgxaq6b4acy4brwjcpvyw4vck6widrwrjy3h5imqrull4u +- valory/market_manager_abci:0.1.0:bafybeif23nzty3mvhvx3tphgr3mdrfo4kadxzg4zi57at2pqvml5yrb2xa +- valory/decision_maker_abci:0.1.0:bafybeigh24stox7axmwxv2smsalr5qyhvgccnn2x3vhzbuenspdoxit3ve +- valory/trader_abci:0.1.0:bafybeicliiseobnghk6yux2sqhs3eb5swyz3eya5exoo3hi4crx7v7lirm +- valory/staking_abci:0.1.0:bafybeifflsc3m5pvxrbhih4xclslhpqdnryilp72wudqffvvttyiung76u default_ledger: ethereum required_ledgers: - ethereum diff --git a/packages/valory/contracts/transfer_nft_condition/contract.yaml b/packages/valory/contracts/transfer_nft_condition/contract.yaml index 4930da6b0..176ca22cb 100644 --- a/packages/valory/contracts/transfer_nft_condition/contract.yaml +++ b/packages/valory/contracts/transfer_nft_condition/contract.yaml @@ -21,9 +21,9 @@ dependencies: eth_typing: {} hexbytes: {} open-aea-ledger-ethereum: - version: ==1.43.0.post1 + version: ==1.44.0 open-aea-test-autonomy: - version: ==0.13.9 + version: ==0.14.0 packaging: {} py-eth-sig-utils: {} requests: diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index b635892e9..29249eefc 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeids5ihwvaindgihdcrfu6lrkg6553zvu3xwhgswqjqmcbgsoxbjlq +agent: valory/trader:0.1.0:bafybeia4m6fzzs6q5ggptchhczukj6rwy4bdtrjhhdubaw2wywzjrotktm number_of_agents: 4 deployment: {} --- diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index 7550512ba..71a0c576c 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -12,62 +12,70 @@ fingerprint: README.md: bafybeia367zzdwndvlhw27rvnwodytjo3ms7gbc3q7mhrrjqjgfasnk47i __init__.py: bafybeih563ujnigeci2ldzh7hakbau6a222vsed7leg3b7lq32vcn3nm4a behaviours/__init__.py: bafybeih6ddz2ocvm6x6ytvlbcz6oi4snb5ee5xh5h65nq4w2qf7fd7zfky - behaviours/base.py: bafybeialr3zhwjenpwp6tu74olnzghtzmuofymidhwekkvhe7uskwczrii - behaviours/bet_placement.py: bafybeigtz4uimsqjjwq4r5p3a5v6niqdtqezbuf2ghy6o7syhsh4k5gjfa - behaviours/blacklisting.py: bafybeierwdzn6vav54l6zym77hhx2vdx3jtnnwpbhwmwwyrqzncwjwkxu4 - behaviours/decision_receive.py: bafybeidvae35fzdmf2hvn3lqkc67zgjy5enu3vi3z5duomlqmf2v4zvxza - behaviours/decision_request.py: bafybeidhmhjxt5xjhznxchqqqh6ohdssyyyzuqxv6dfdvpza7c2bxigajq + behaviours/base.py: bafybeid5di6dt45myls6nggxd5422vlkqzgxb4hxe4lmdolgvmnntzemlm + behaviours/bet_placement.py: bafybeib7jgq7iyfoyj3ur3xkj6knh7t7vr32kc743ztyjskkdevyh6l75q + behaviours/blacklisting.py: bafybeic7o2jzmhbamdcebbdjeie3dkm7y2wq7xutpeshqmrt2hdq65vlai + behaviours/claim_subscription.py: bafybeihctnttpg5ckv5653iqwidbfxqif3ox35zwuaf52wfjfmpgtxv7em + behaviours/decision_receive.py: bafybeig4gmlad7epkaao6nsfqya3zqhllt4hwiijtarcczmokxekxehrcu + behaviours/decision_request.py: bafybeicpvpsdbcfvtiapnprp4j45exy5atyshfwgzksj3jptstlv6kgiwy behaviours/handle_failed_tx.py: bafybeidxpc6u575ymct5tdwutvzov6zqfdoio5irgldn3fw7q3lg36mmxm + behaviours/order_subscription.py: bafybeiehmurti6cmarlaqqgr45fou6js5gb4cbbul7n36chyb4ks3jxtay + behaviours/randomness.py: bafybeidmr33teizrs4uxlo5tdz766ds6os4pe5lttstm7jpmhgmjz5ti3q behaviours/reedem.py: bafybeibenzbek5qdtk3gobjxfmsm6tg6i3d4yltozymy23izpgbcpal5ye - behaviours/round_behaviour.py: bafybeig4tdktyu6hapoqymnxh2bgpds547st6a44heue657wkctwe4gjvm - behaviours/sampling.py: bafybeifzhm4sspdvt227ksl5hjn26offgqpwempgbcwbr6dq7gyi2a46sm - behaviours/tool_selection.py: bafybeifpvrrbftlkjsoiysnasihzttousk6hxnukzrln6z2d33e3zexkje + behaviours/round_behaviour.py: bafybeidrks62unrnoyp3jnbz2nozgnittfntyknymuuja7jwcsjuap4fve + behaviours/sampling.py: bafybeibtkli72qsvotkrsepkgpiumtr5sershtkpb427oygnszs3dpgxry + behaviours/tool_selection.py: bafybeicxw4je76uc7znx4u2hq2b2aaxcf7blwfla7lhdhkqnf3kkupsczq dialogues.py: bafybeigpwuzku3we7axmxeamg7vn656maww6emuztau5pg3ebsoquyfdqm - fsm_specification.yaml: bafybeidqrxj3l3e555znk4wxx6spwaijz3bhc5yialhzbhd6ngk52w7jbq + fsm_specification.yaml: bafybeiffj7du76sxaaaginlscphhqfmqwxtbmsuv6yuvllz2tblijlgcau handlers.py: bafybeiggoetspwcvdojmbjdd67tmkoeedikmt6vsbcium3zjaljb6jzqu4 io_/__init__.py: bafybeifxgmmwjqzezzn3e6keh2bfo4cyo7y5dq2ept3stfmgglbrzfl5rq io_/loader.py: bafybeih3sdsx5dhe4kzhtoafexjgkutsujwqy3zcdrlrkhtdks45bc7exa - models.py: bafybeif63pruksc6fpvmg77jmsrphc36uiawypzzcrk6nbpzoglbpxnlfy - payloads.py: bafybeigcic4vewdglakzpyqevhfwsolh4ywnbvxo5bgned7gl5uo3jif7m - policy.py: bafybeidpmx4ek3qze63zpuwixyf6t7bdv62ewgkzt3ljrzadiwdw64cueq + models.py: bafybeihzxf3dhx73lk7d56ir7zhmz2x6u5x6aga6f7rfms37zkvaqhfelm + payloads.py: bafybeibmjrckgsflqulviynadl6bx3keuabvhfolkiib7cmjhfsov2vuty + policy.py: bafybeihca4gc5gdj3wmvtzulqq3cr4zm6ouyt7aoscfedutzr4so4bksna redeem_info.py: bafybeifiiix4gihfo4avraxt34sfw35v6dqq45do2drrssei2shbps63mm - rounds.py: bafybeifvov25vwzbbzgg4zvtptsnqve7t7hbjq3b7wuhie4fdwq2e7th7q + rounds.py: bafybeiajc5mh3fhepfs4st47hasavseomihaknq4yz73gjqnvwa2dplfvu states/__init__.py: bafybeid23llnyp6j257dluxmrnztugo5llsrog7kua53hllyktz4dqhqoy - states/base.py: bafybeibhcc4pc3m6qelvdvxssnuglcwfaff55cr2kule74ekauyf3bahpq + states/base.py: bafybeid4khumtvfw5n37avkf3kujfxdwhfjcsnzpmyjeljkpcako5f2duy states/bet_placement.py: bafybeibalhxhp2c4oljmiwqi6ds3g36fgtabmf42mb5sgq6z22znrcbhda states/blacklisting.py: bafybeifruvxwwltndwazkzzbpc5nnnad3z5t5ofy6d3i7nssljbxl6gvxu + states/claim_subscription.py: bafybeiampifhdoztggwj6gthl2hfzecmjcwnm6nic2o47q4je7j4x3ujne states/decision_receive.py: bafybeib3roo27nccj4eylaqwwzztzzzwsi6px5atjrch5wbqmpln2kyy6y states/decision_request.py: bafybeic7otc3hjb753svbmur3yyk6szahc25yii3x4w4vcnpfz6jwvacuu - states/final_states.py: bafybeidiwhuyd5zm2cq7vhv2owcrxdpm7fnvn3db6p6tql4jz5hgpalflu + states/final_states.py: bafybeidmlhpjvsdogejrvaczk3tfcbh7f7ijectshh23qi5yzktozzunee states/handle_failed_tx.py: bafybeihewm2vernvhktuorljdupjqcg2p5vs6wvsira2d62wkoyo5xlzjm + states/order_subscription.py: bafybeiaoemltuh3zkch7hvaxzxxsofe3pomlgifj5hamkqqon5mg5eaoqq + states/randomness.py: bafybeifgsyipvvu2e6caggyoo5vsmd64uexuho5ybyf3ry424r7kldcfre states/redeem.py: bafybeiblidmpt73ocac73wmakusrnf5267vs7s2foc5pqkrz4vuqgy3b4u - states/sampling.py: bafybeidnvdogjlthjfe7jpaiuezm3xydrbxxukyoss4gx6t5fdin52rsta + states/sampling.py: bafybeihriyyskmlupjiwytx2pdpftms7plkjku5bip64c3ztx7oi3n43ci states/tool_selection.py: bafybeiaaijv6dukp3bmsptcwkcmumc6wu6ztzkvaqzsqqjbfn4ozgyuykq tests/__init__.py: bafybeiakpi3k3kc7wrjj7hrluvjcj36lu2gezpmrctwiz5yg2fe7ggnf3i tests/behaviours/__init__.py: bafybeic7icz7lfhfepdkqkase7y7zn3a6pwdw6fx4ah2hajmgejawpolc4 tests/behaviours/test_base.py: bafybeidemmwjhtr6i4tq66jyqkpmb425ersfmk7k7zzjmeaz2idqnpcwve tests/conftest.py: bafybeidy5hw56kw5mxudnfbhvogofn6k4rqb4ux2bd45baedrrhmgyrude + utils/__init__.py: bafybeiazrfg3kwfdl5q45azwz6b6mobqxngxpf4hazmrnkhinpk4qhbbf4 + utils/nevermined.py: bafybeidw4ydwqo7dmdfu2oqx4lmgho5ciakthx6rj2iwgt7bywvnppbxuy fingerprint_ignore_patterns: [] connections: [] contracts: -- valory/gnosis_safe:0.1.0:bafybeic54u6jwqicav2xtkm6kfb3udjvxzufch5z3vwoloe72a7sjlhgua -- valory/market_maker:0.1.0:bafybeihcueo3ct3h5fqyrwsjeofr5winyxlnegnwdvofopwhrfzkhgpxte -- valory/erc20:0.1.0:bafybeiecuaahlywb2rw6s76av5rdqg4gad6j753to6aqrix7zmbbt6kj6q +- valory/gnosis_safe:0.1.0:bafybeia53amnoc2py4io773sblsiy4woaebckiidbkvulow62crpocvbny +- valory/market_maker:0.1.0:bafybeibgvm6jjrh26hvli3lqgi3xr7ihtjwu5pcbaeominq3w6zaksttle +- valory/erc20:0.1.0:bafybeichh4vg3mav7pkv4nymw4wpnnyhd6lm2uzmjpcsrqetxi2x4g7b2m - valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y -- valory/mech:0.1.0:bafybeigmkbovcb6wcfqkkmmryo6kzqsai5qq325lzmsvtlxe4fn6rcmwoy +- valory/mech:0.1.0:bafybeigbpvjbdnxwwxlee47thv2xuwxk4qte7k6yxzuv4qlczl5ecjh6ie - valory/conditional_tokens:0.1.0:bafybeigucumqbsk74nj4rpm4p2cpiky4dj6uws7nfmgpimuviaxcamwqnu - valory/realitio:0.1.0:bafybeic5ie4oodetj4krdogydvbfxg4qggc3matpiflocah626tpevpreq - valory/realitio_proxy:0.1.0:bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4 -- valory/agent_registry:0.1.0:bafybeib5czj6b3q6cukykbddo2nmn7etgmle53erq7ucapz5o7dzunno4a -- valory/transfer_nft_condition:0.1.0:bafybeihoeso5lhptekpvsrt77dxenyl2te45ujl7llyeaf2uv22affghre +- valory/agent_registry:0.1.0:bafybeifdsvdensn52cngcwdcathmlu6vhsmzcljemfrb5uozsigzgwcvuy +- valory/transfer_nft_condition:0.1.0:bafybeig6j2tgy54mjpeqntrrcdzi32cogche57k4spsz6nz3yvouvb275u protocols: -- valory/contract_api:1.0.0:bafybeialhbjvwiwcnqq3ysxcyemobcbie7xza66gaofcvla5njezkvhcka -- valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru -- valory/ipfs:0.1.0:bafybeiedxeismnx3k5ty4mvvhlqideixlhqmi5mtcki4lxqfa7uqh7p33u +- valory/contract_api:1.0.0:bafybeidgu7o5llh26xp3u3ebq3yluull5lupiyeu6iooi2xyymdrgnzq5i +- valory/ledger_api:1.0.0:bafybeihdk6psr4guxmbcrc26jr2cbgzpd5aljkqvpwo64bvaz7tdti2oni +- valory/ipfs:0.1.0:bafybeiftxi2qhreewgsc5wevogi7yc5g6hbcbo4uiuaibauhv3nhfcdtvm skills: -- valory/abstract_round_abci:0.1.0:bafybeidbmd2cgffqqfwsyxws5dffsc6nbt5ijgkbhyzse5i42yddmwqlpy -- valory/market_manager_abci:0.1.0:bafybeicqjiqq63bcb6colaq4adwsn7o6zhyd7n5ftwdv4kvt3rqxhnapw4 -- valory/transaction_settlement_abci:0.1.0:bafybeidsfwslnbhhhplvgteeec7idrhm7gxpay4f36wwnkgl4mh7ogovke +- valory/abstract_round_abci:0.1.0:bafybeibna634t4w4udainzsuxwfydkbcy33alcqy6ugalcfuhoyhr53gs4 +- valory/market_manager_abci:0.1.0:bafybeif23nzty3mvhvx3tphgr3mdrfo4kadxzg4zi57at2pqvml5yrb2xa +- valory/transaction_settlement_abci:0.1.0:bafybeic3ysdc46z4ipuonc2g6vdyqaxxljvfd45cflzi2xq7o7hre6lvvy behaviours: main: args: {} diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index 867ed801d..60780ad7e 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -9,9 +9,9 @@ fingerprint: README.md: bafybeiab4xgadptz4mhvno4p6xvkh7p4peg7iuhotabydriu74dmj6ljga __init__.py: bafybeido7wa33h4dtleap57vzgyb4fsofk4vindsqcekyfo5i56i2rll2a behaviours.py: bafybeieesrefrpo5c5upzztgm5fwfrmxeagilacuau5nacobhsfvgpbzby - composition.py: bafybeiajga2m7pv7v4bxsjsnncavdns6gujg7qg7opfjyznlzip3gbd3nm + composition.py: bafybeif75v3swf2pmxi3rdd5kqdfv4ap5uapcbszkiohhur67oemrgotay dialogues.py: bafybeiebofyykseqp3fmif36cqmmyf3k7d2zbocpl6t6wnlpv4szghrxbm - fsm_specification.yaml: bafybeib3ycl5bjo5uilyaly7uoovvc3b3gpjrkuvdos5ffsgmrs73j6bkm + fsm_specification.yaml: bafybeifm3qvycqhnq6kr7xteabt7t3ud7es7qeeiy3imnpw7hf6oghpl64 handlers.py: bafybeibkiqwe7hoqccjirimd44nzeqkabc7oo74romqklssion27s5sa2a models.py: bafybeibrxivgpzamfmrl6bdngi67g72i32lmu5vgdn3jbwka265blk7ire fingerprint_ignore_patterns: [] @@ -19,15 +19,15 @@ connections: [] contracts: [] protocols: [] skills: -- valory/abstract_round_abci:0.1.0:bafybeidbmd2cgffqqfwsyxws5dffsc6nbt5ijgkbhyzse5i42yddmwqlpy -- valory/registration_abci:0.1.0:bafybeieylbkzk3zju6un3xysextycnj72aniq2britpvnniud4ekglcbbi -- valory/reset_pause_abci:0.1.0:bafybeida6w2afp4m3dvnbkbwxz67ozjlry3wpsbkxwz7usalm3o2ghy46u -- valory/transaction_settlement_abci:0.1.0:bafybeidsfwslnbhhhplvgteeec7idrhm7gxpay4f36wwnkgl4mh7ogovke -- valory/termination_abci:0.1.0:bafybeid5ipudhwuiuhbzvpn4usgdm3a3ow3naafuefvetmgbbcy6ugyuwi -- valory/market_manager_abci:0.1.0:bafybeicqjiqq63bcb6colaq4adwsn7o6zhyd7n5ftwdv4kvt3rqxhnapw4 -- valory/decision_maker_abci:0.1.0:bafybeictykibll26pjydtfmg54hpyoebwx2linmiatohrwpgvd35lwmyha -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeia4je5sswi5djvrvlscbms5opten5uxzdcs64rysje4an4ylgitri -- valory/staking_abci:0.1.0:bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u +- valory/abstract_round_abci:0.1.0:bafybeibna634t4w4udainzsuxwfydkbcy33alcqy6ugalcfuhoyhr53gs4 +- valory/registration_abci:0.1.0:bafybeifvglcgcyla5abdth4htjxbom7vidzytk5pfjfnslpbxox2cyjxse +- valory/reset_pause_abci:0.1.0:bafybeigkf7uh6zre3wc3btm2we7xffls4e4vurvtsou2nswbn6mcc3g52a +- valory/transaction_settlement_abci:0.1.0:bafybeic3ysdc46z4ipuonc2g6vdyqaxxljvfd45cflzi2xq7o7hre6lvvy +- valory/termination_abci:0.1.0:bafybeif7dwj4i5okp7rsyeiyvnmt5xop7njvj27bmjqdx4skmimqls7t4e +- valory/market_manager_abci:0.1.0:bafybeif23nzty3mvhvx3tphgr3mdrfo4kadxzg4zi57at2pqvml5yrb2xa +- valory/decision_maker_abci:0.1.0:bafybeigh24stox7axmwxv2smsalr5qyhvgccnn2x3vhzbuenspdoxit3ve +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeicels3hbgxaq6b4acy4brwjcpvyw4vck6widrwrjy3h5imqrull4u +- valory/staking_abci:0.1.0:bafybeifflsc3m5pvxrbhih4xclslhpqdnryilp72wudqffvvttyiung76u behaviours: main: args: {} diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index d1db46fce..c5407e442 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -10,19 +10,19 @@ fingerprint: __init__.py: bafybeide6k22zk4f3hyzhpapaoddsnxpw5elqcfvrxxj4nfvpzctv6jqhu behaviours.py: bafybeictumcqn2pgo7y2duemvzoaafognfhl6s6il3tv53hq66tf7xgpsu dialogues.py: bafybeiebofyykseqp3fmif36cqmmyf3k7d2zbocpl6t6wnlpv4szghrxbm - fsm_specification.yaml: bafybeidwxjna36auqbtqlehx73kyb6o74suhzj5bothgtiapcj35b7gzve + fsm_specification.yaml: bafybeib7nmznbbug6icxyahy34r6ory7ujkwnlakv3bgmnlecysr46l5v4 handlers.py: bafybeiafbqr7ojfcbwohvee7x4zzswad3ymfrrbjlfz7uuuttmn3qdfs6q models.py: bafybeigtmxoecoow663hgqnyinxarlrttyyt5ghpbdamdv4tc4kikcfx3a - rounds.py: bafybeictknoifjphmgviw3b6mh3srgqlw2lhfkedqu5fumoxuwpehlhioq + rounds.py: bafybeictmmkmkxsbij4zhcsth6avb477tzhqaycpjkx2igtec2czszx6hu fingerprint_ignore_patterns: [] connections: [] contracts: [] protocols: -- valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru +- valory/ledger_api:1.0.0:bafybeihdk6psr4guxmbcrc26jr2cbgzpd5aljkqvpwo64bvaz7tdti2oni skills: -- valory/abstract_round_abci:0.1.0:bafybeidbmd2cgffqqfwsyxws5dffsc6nbt5ijgkbhyzse5i42yddmwqlpy -- valory/decision_maker_abci:0.1.0:bafybeictykibll26pjydtfmg54hpyoebwx2linmiatohrwpgvd35lwmyha -- valory/staking_abci:0.1.0:bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u +- valory/abstract_round_abci:0.1.0:bafybeibna634t4w4udainzsuxwfydkbcy33alcqy6ugalcfuhoyhr53gs4 +- valory/decision_maker_abci:0.1.0:bafybeigh24stox7axmwxv2smsalr5qyhvgccnn2x3vhzbuenspdoxit3ve +- valory/staking_abci:0.1.0:bafybeifflsc3m5pvxrbhih4xclslhpqdnryilp72wudqffvvttyiung76u behaviours: main: args: {} From 207c5ce75a8c90e8672a57924da9efc6f523d44e Mon Sep 17 00:00:00 2001 From: Ardian Date: Fri, 19 Jan 2024 13:18:51 +0100 Subject: [PATCH 11/12] chore: fsm spec --- packages/packages.json | 10 +-- packages/valory/agents/trader/aea-config.yaml | 6 +- packages/valory/services/trader/service.yaml | 2 +- .../fsm_specification.yaml | 6 +- .../skills/decision_maker_abci/rounds.py | 89 +++++++++++-------- .../skills/decision_maker_abci/skill.yaml | 4 +- .../skills/trader_abci/fsm_specification.yaml | 5 +- packages/valory/skills/trader_abci/skill.yaml | 6 +- .../tx_settlement_multiplexer_abci/skill.yaml | 2 +- 9 files changed, 75 insertions(+), 55 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index b08db0a21..17ddd2938 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -1,13 +1,13 @@ { "dev": { "skill/valory/market_manager_abci/0.1.0": "bafybeif23nzty3mvhvx3tphgr3mdrfo4kadxzg4zi57at2pqvml5yrb2xa", - "skill/valory/decision_maker_abci/0.1.0": "bafybeigh24stox7axmwxv2smsalr5qyhvgccnn2x3vhzbuenspdoxit3ve", - "skill/valory/trader_abci/0.1.0": "bafybeicliiseobnghk6yux2sqhs3eb5swyz3eya5exoo3hi4crx7v7lirm", + "skill/valory/decision_maker_abci/0.1.0": "bafybeigklkydkulavsuk2xkau5qlpggc7hmbre57jmxgcmonrlo6siidg4", + "skill/valory/trader_abci/0.1.0": "bafybeidexy2xjeswefufqv7ygu3hyfa4zdesmjkbfq3oqy266jgykfbrmm", "contract/valory/market_maker/0.1.0": "bafybeibgvm6jjrh26hvli3lqgi3xr7ihtjwu5pcbaeominq3w6zaksttle", - "agent/valory/trader/0.1.0": "bafybeia4m6fzzs6q5ggptchhczukj6rwy4bdtrjhhdubaw2wywzjrotktm", - "service/valory/trader/0.1.0": "bafybeiasxp5dxh7ddjdl74lbrtr55ebtgifrdc6vaxz5mlyk4dqhbyog54", + "agent/valory/trader/0.1.0": "bafybeihdduvxtmsbvdxlhf3xqf4rydcjezx2i5nfq3nxxrozziai5khlma", + "service/valory/trader/0.1.0": "bafybeifb6mqhr5llvons24fzd2q6v7o6bduk5fkqpkz6fzm4rayfy7atni", "contract/valory/erc20/0.1.0": "bafybeichh4vg3mav7pkv4nymw4wpnnyhd6lm2uzmjpcsrqetxi2x4g7b2m", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeicels3hbgxaq6b4acy4brwjcpvyw4vck6widrwrjy3h5imqrull4u", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeigd4qfjllcyembuwap5jow7r63vinlzdixad6br4g5esxxgwn3zvu", "contract/valory/mech/0.1.0": "bafybeigbpvjbdnxwwxlee47thv2xuwxk4qte7k6yxzuv4qlczl5ecjh6ie", "contract/valory/realitio/0.1.0": "bafybeic5ie4oodetj4krdogydvbfxg4qggc3matpiflocah626tpevpreq", "contract/valory/realitio_proxy/0.1.0": "bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4", diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index 4845f7498..ff43eda6b 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -44,10 +44,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeigkf7uh6zre3wc3btm2we7xffls4e4vurvtsou2nswbn6mcc3g52a - valory/termination_abci:0.1.0:bafybeif7dwj4i5okp7rsyeiyvnmt5xop7njvj27bmjqdx4skmimqls7t4e - valory/transaction_settlement_abci:0.1.0:bafybeic3ysdc46z4ipuonc2g6vdyqaxxljvfd45cflzi2xq7o7hre6lvvy -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeicels3hbgxaq6b4acy4brwjcpvyw4vck6widrwrjy3h5imqrull4u +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeigd4qfjllcyembuwap5jow7r63vinlzdixad6br4g5esxxgwn3zvu - valory/market_manager_abci:0.1.0:bafybeif23nzty3mvhvx3tphgr3mdrfo4kadxzg4zi57at2pqvml5yrb2xa -- valory/decision_maker_abci:0.1.0:bafybeigh24stox7axmwxv2smsalr5qyhvgccnn2x3vhzbuenspdoxit3ve -- valory/trader_abci:0.1.0:bafybeicliiseobnghk6yux2sqhs3eb5swyz3eya5exoo3hi4crx7v7lirm +- valory/decision_maker_abci:0.1.0:bafybeigklkydkulavsuk2xkau5qlpggc7hmbre57jmxgcmonrlo6siidg4 +- valory/trader_abci:0.1.0:bafybeidexy2xjeswefufqv7ygu3hyfa4zdesmjkbfq3oqy266jgykfbrmm - valory/staking_abci:0.1.0:bafybeifflsc3m5pvxrbhih4xclslhpqdnryilp72wudqffvvttyiung76u default_ledger: ethereum required_ledgers: diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index 29249eefc..bebb31e60 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeia4m6fzzs6q5ggptchhczukj6rwy4bdtrjhhdubaw2wywzjrotktm +agent: valory/trader:0.1.0:bafybeihdduvxtmsbvdxlhf3xqf4rydcjezx2i5nfq3nxxrozziai5khlma number_of_agents: 4 deployment: {} --- diff --git a/packages/valory/skills/decision_maker_abci/fsm_specification.yaml b/packages/valory/skills/decision_maker_abci/fsm_specification.yaml index f484e5b42..4b5e198b1 100644 --- a/packages/valory/skills/decision_maker_abci/fsm_specification.yaml +++ b/packages/valory/skills/decision_maker_abci/fsm_specification.yaml @@ -42,6 +42,7 @@ states: - FinishedWithoutRedeemingRound - HandleFailedTxRound - ImpossibleRound +- RandomnessRound - RedeemRound - RefillRequiredRound - SamplingRound @@ -58,7 +59,7 @@ transition_func: (BlacklistingRound, NONE): ImpossibleRound (BlacklistingRound, NO_MAJORITY): BlacklistingRound (BlacklistingRound, ROUND_TIMEOUT): BlacklistingRound - (ClaimRound, DONE): ToolSelectionRound + (ClaimRound, DONE): RandomnessRound (ClaimRound, NO_MAJORITY): ClaimRound (ClaimRound, ROUND_TIMEOUT): ClaimRound (ClaimRound, SUBSCRIPTION_ERROR): ClaimRound @@ -85,12 +86,13 @@ transition_func: (RedeemRound, NO_REDEEMING): FinishedWithoutRedeemingRound (RedeemRound, REDEEM_ROUND_TIMEOUT): FinishedWithoutRedeemingRound (SamplingRound, DONE): SubscriptionRound + (SamplingRound, FETCH_ERROR): ImpossibleRound (SamplingRound, NONE): FinishedWithoutDecisionRound (SamplingRound, NO_MAJORITY): SamplingRound (SamplingRound, ROUND_TIMEOUT): SamplingRound (SubscriptionRound, DONE): FinishedSubscriptionRound (SubscriptionRound, NO_MAJORITY): SubscriptionRound - (SubscriptionRound, NO_SUBSCRIPTION): ToolSelectionRound + (SubscriptionRound, NO_SUBSCRIPTION): RandomnessRound (SubscriptionRound, ROUND_TIMEOUT): SubscriptionRound (SubscriptionRound, SUBSCRIPTION_ERROR): SubscriptionRound (ToolSelectionRound, DONE): DecisionRequestRound diff --git a/packages/valory/skills/decision_maker_abci/rounds.py b/packages/valory/skills/decision_maker_abci/rounds.py index e25d2b497..967d28f09 100644 --- a/packages/valory/skills/decision_maker_abci/rounds.py +++ b/packages/valory/skills/decision_maker_abci/rounds.py @@ -76,61 +76,78 @@ class DecisionMakerAbciApp(AbciApp[Event]): Initial round: SamplingRound - Initial states: {DecisionReceiveRound, HandleFailedTxRound, RedeemRound, SamplingRound} + Initial states: {ClaimRound, DecisionReceiveRound, HandleFailedTxRound, RedeemRound, SamplingRound} Transition states: 0. SamplingRound - done: 1. - - none: 9. + - none: 12. - no majority: 0. - round timeout: 0. - 1. ToolSelectionRound - - done: 2. - - none: 1. + - fetch error: 16. + 1. SubscriptionRound + - done: 14. + - no subscription: 3. + - subscription error: 1. - no majority: 1. - round timeout: 1. - 2. DecisionRequestRound - - done: 8. - - slots unsupported error: 4. + 2. ClaimRound + - done: 3. + - subscription error: 2. - no majority: 2. - round timeout: 2. - - none: 12. - 3. DecisionReceiveRound - - done: 5. - - mech response error: 4. - - no majority: 3. - - tie: 4. - - unprofitable: 4. + 3. RandomnessRound + - done: 4. - round timeout: 3. - 4. BlacklistingRound - - done: 9. - - none: 12. + - no majority: 3. + 4. ToolSelectionRound + - done: 5. + - none: 4. - no majority: 4. - round timeout: 4. - - fetch error: 12. - 5. BetPlacementRound - - done: 8. - - insufficient balance: 11. + 5. DecisionRequestRound + - done: 11. + - slots unsupported error: 7. - no majority: 5. - round timeout: 5. - - none: 12. - 6. RedeemRound + - none: 16. + 6. DecisionReceiveRound - done: 8. - - no redeeming: 10. + - mech response error: 7. - no majority: 6. - - redeem round timeout: 10. - - none: 12. - 7. HandleFailedTxRound - - blacklist: 4. - - no op: 6. + - tie: 7. + - unprofitable: 7. + - round timeout: 6. + 7. BlacklistingRound + - done: 12. + - none: 16. - no majority: 7. - 8. FinishedDecisionMakerRound - 9. FinishedWithoutDecisionRound - 10. FinishedWithoutRedeemingRound - 11. RefillRequiredRound - 12. ImpossibleRound + - round timeout: 7. + - fetch error: 16. + 8. BetPlacementRound + - done: 11. + - insufficient balance: 15. + - no majority: 8. + - round timeout: 8. + - none: 16. + 9. RedeemRound + - done: 11. + - no redeeming: 13. + - no majority: 9. + - redeem round timeout: 13. + - none: 16. + 10. HandleFailedTxRound + - blacklist: 7. + - no op: 9. + - no majority: 10. + 11. FinishedDecisionMakerRound + 12. FinishedWithoutDecisionRound + 13. FinishedWithoutRedeemingRound + 14. FinishedSubscriptionRound + 15. RefillRequiredRound + 16. ImpossibleRound - Final states: {FinishedDecisionMakerRound, FinishedWithoutDecisionRound, FinishedWithoutRedeemingRound, ImpossibleRound, RefillRequiredRound} + Final states: {FinishedDecisionMakerRound, FinishedSubscriptionRound, FinishedWithoutDecisionRound, FinishedWithoutRedeemingRound, ImpossibleRound, RefillRequiredRound} Timeouts: round timeout: 30.0 diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index 71a0c576c..c7d9a4c37 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -26,7 +26,7 @@ fingerprint: behaviours/sampling.py: bafybeibtkli72qsvotkrsepkgpiumtr5sershtkpb427oygnszs3dpgxry behaviours/tool_selection.py: bafybeicxw4je76uc7znx4u2hq2b2aaxcf7blwfla7lhdhkqnf3kkupsczq dialogues.py: bafybeigpwuzku3we7axmxeamg7vn656maww6emuztau5pg3ebsoquyfdqm - fsm_specification.yaml: bafybeiffj7du76sxaaaginlscphhqfmqwxtbmsuv6yuvllz2tblijlgcau + fsm_specification.yaml: bafybeic2brgmxbuza2ztpb554ggubt66xxj7leuynbcjmym235doq6qi5y handlers.py: bafybeiggoetspwcvdojmbjdd67tmkoeedikmt6vsbcium3zjaljb6jzqu4 io_/__init__.py: bafybeifxgmmwjqzezzn3e6keh2bfo4cyo7y5dq2ept3stfmgglbrzfl5rq io_/loader.py: bafybeih3sdsx5dhe4kzhtoafexjgkutsujwqy3zcdrlrkhtdks45bc7exa @@ -34,7 +34,7 @@ fingerprint: payloads.py: bafybeibmjrckgsflqulviynadl6bx3keuabvhfolkiib7cmjhfsov2vuty policy.py: bafybeihca4gc5gdj3wmvtzulqq3cr4zm6ouyt7aoscfedutzr4so4bksna redeem_info.py: bafybeifiiix4gihfo4avraxt34sfw35v6dqq45do2drrssei2shbps63mm - rounds.py: bafybeiajc5mh3fhepfs4st47hasavseomihaknq4yz73gjqnvwa2dplfvu + rounds.py: bafybeigisg437wfshf5xc3uxjpru4x74be4lj6ieoxsba6klkkmg7dz5ni states/__init__.py: bafybeid23llnyp6j257dluxmrnztugo5llsrog7kua53hllyktz4dqhqoy states/base.py: bafybeid4khumtvfw5n37avkf3kujfxdwhfjcsnzpmyjeljkpcako5f2duy states/bet_placement.py: bafybeibalhxhp2c4oljmiwqi6ds3g36fgtabmf42mb5sgq6z22znrcbhda diff --git a/packages/valory/skills/trader_abci/fsm_specification.yaml b/packages/valory/skills/trader_abci/fsm_specification.yaml index ad1b7e1fb..cb5e97ea6 100644 --- a/packages/valory/skills/trader_abci/fsm_specification.yaml +++ b/packages/valory/skills/trader_abci/fsm_specification.yaml @@ -61,6 +61,7 @@ states: - ImpossibleRound - PostTxSettlementRound - PreTxSettlementRound +- RandomnessRound - RandomnessTransactionSubmissionRound - RedeemRound - RegistrationRound @@ -104,7 +105,7 @@ transition_func: (CheckTransactionHistoryRound, NEGATIVE): SelectKeeperTransactionSubmissionBRound (CheckTransactionHistoryRound, NONE): HandleFailedTxRound (CheckTransactionHistoryRound, NO_MAJORITY): CheckTransactionHistoryRound - (ClaimRound, DONE): ToolSelectionRound + (ClaimRound, DONE): RandomnessRound (ClaimRound, NO_MAJORITY): ClaimRound (ClaimRound, ROUND_TIMEOUT): ClaimRound (ClaimRound, SUBSCRIPTION_ERROR): ClaimRound @@ -183,7 +184,7 @@ transition_func: (SelectKeeperTransactionSubmissionBRound, ROUND_TIMEOUT): SelectKeeperTransactionSubmissionBRound (SubscriptionRound, DONE): PreTxSettlementRound (SubscriptionRound, NO_MAJORITY): SubscriptionRound - (SubscriptionRound, NO_SUBSCRIPTION): ToolSelectionRound + (SubscriptionRound, NO_SUBSCRIPTION): RandomnessRound (SubscriptionRound, ROUND_TIMEOUT): SubscriptionRound (SubscriptionRound, SUBSCRIPTION_ERROR): SubscriptionRound (SynchronizeLateMessagesRound, DONE): CheckLateTxHashesRound diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index 60780ad7e..018f35226 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -11,7 +11,7 @@ fingerprint: behaviours.py: bafybeieesrefrpo5c5upzztgm5fwfrmxeagilacuau5nacobhsfvgpbzby composition.py: bafybeif75v3swf2pmxi3rdd5kqdfv4ap5uapcbszkiohhur67oemrgotay dialogues.py: bafybeiebofyykseqp3fmif36cqmmyf3k7d2zbocpl6t6wnlpv4szghrxbm - fsm_specification.yaml: bafybeifm3qvycqhnq6kr7xteabt7t3ud7es7qeeiy3imnpw7hf6oghpl64 + fsm_specification.yaml: bafybeihrf45yaqlq37ro3todw7f2p43eugirtnsefr6345f4n5v44q3nuu handlers.py: bafybeibkiqwe7hoqccjirimd44nzeqkabc7oo74romqklssion27s5sa2a models.py: bafybeibrxivgpzamfmrl6bdngi67g72i32lmu5vgdn3jbwka265blk7ire fingerprint_ignore_patterns: [] @@ -25,8 +25,8 @@ skills: - valory/transaction_settlement_abci:0.1.0:bafybeic3ysdc46z4ipuonc2g6vdyqaxxljvfd45cflzi2xq7o7hre6lvvy - valory/termination_abci:0.1.0:bafybeif7dwj4i5okp7rsyeiyvnmt5xop7njvj27bmjqdx4skmimqls7t4e - valory/market_manager_abci:0.1.0:bafybeif23nzty3mvhvx3tphgr3mdrfo4kadxzg4zi57at2pqvml5yrb2xa -- valory/decision_maker_abci:0.1.0:bafybeigh24stox7axmwxv2smsalr5qyhvgccnn2x3vhzbuenspdoxit3ve -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeicels3hbgxaq6b4acy4brwjcpvyw4vck6widrwrjy3h5imqrull4u +- valory/decision_maker_abci:0.1.0:bafybeigklkydkulavsuk2xkau5qlpggc7hmbre57jmxgcmonrlo6siidg4 +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeigd4qfjllcyembuwap5jow7r63vinlzdixad6br4g5esxxgwn3zvu - valory/staking_abci:0.1.0:bafybeifflsc3m5pvxrbhih4xclslhpqdnryilp72wudqffvvttyiung76u behaviours: main: diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index c5407e442..c2942dca3 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -21,7 +21,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeihdk6psr4guxmbcrc26jr2cbgzpd5aljkqvpwo64bvaz7tdti2oni skills: - valory/abstract_round_abci:0.1.0:bafybeibna634t4w4udainzsuxwfydkbcy33alcqy6ugalcfuhoyhr53gs4 -- valory/decision_maker_abci:0.1.0:bafybeigh24stox7axmwxv2smsalr5qyhvgccnn2x3vhzbuenspdoxit3ve +- valory/decision_maker_abci:0.1.0:bafybeigklkydkulavsuk2xkau5qlpggc7hmbre57jmxgcmonrlo6siidg4 - valory/staking_abci:0.1.0:bafybeifflsc3m5pvxrbhih4xclslhpqdnryilp72wudqffvvttyiung76u behaviours: main: From 4c09b527309c50359760b61cff913956c108a975 Mon Sep 17 00:00:00 2001 From: Ardian Date: Fri, 19 Jan 2024 13:25:00 +0100 Subject: [PATCH 12/12] chore: fsm spec --- packages/packages.json | 10 +++++----- packages/valory/agents/trader/aea-config.yaml | 6 +++--- packages/valory/services/trader/service.yaml | 2 +- .../skills/decision_maker_abci/fsm_specification.yaml | 1 + packages/valory/skills/decision_maker_abci/rounds.py | 2 ++ packages/valory/skills/decision_maker_abci/skill.yaml | 4 ++-- .../valory/skills/trader_abci/fsm_specification.yaml | 1 + packages/valory/skills/trader_abci/skill.yaml | 6 +++--- .../skills/tx_settlement_multiplexer_abci/skill.yaml | 2 +- 9 files changed, 19 insertions(+), 15 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index 17ddd2938..0f80aebeb 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -1,13 +1,13 @@ { "dev": { "skill/valory/market_manager_abci/0.1.0": "bafybeif23nzty3mvhvx3tphgr3mdrfo4kadxzg4zi57at2pqvml5yrb2xa", - "skill/valory/decision_maker_abci/0.1.0": "bafybeigklkydkulavsuk2xkau5qlpggc7hmbre57jmxgcmonrlo6siidg4", - "skill/valory/trader_abci/0.1.0": "bafybeidexy2xjeswefufqv7ygu3hyfa4zdesmjkbfq3oqy266jgykfbrmm", + "skill/valory/decision_maker_abci/0.1.0": "bafybeidh3efbssuohhuku5b4go5jeqti4xv6dsdpaxm3ti4rudgqmyujpq", + "skill/valory/trader_abci/0.1.0": "bafybeifildb45hkpmusursxm3n7tg6bw42xfn4ssa2b7k73tu3og3nesze", "contract/valory/market_maker/0.1.0": "bafybeibgvm6jjrh26hvli3lqgi3xr7ihtjwu5pcbaeominq3w6zaksttle", - "agent/valory/trader/0.1.0": "bafybeihdduvxtmsbvdxlhf3xqf4rydcjezx2i5nfq3nxxrozziai5khlma", - "service/valory/trader/0.1.0": "bafybeifb6mqhr5llvons24fzd2q6v7o6bduk5fkqpkz6fzm4rayfy7atni", + "agent/valory/trader/0.1.0": "bafybeihddqmhwhnelfclqocgahnbb4ipdhkatqsttl5acne62ifupfaw7i", + "service/valory/trader/0.1.0": "bafybeigd3mxyqb3koliro7oohkfegonqyz3bacihstytho2iazwcocahoq", "contract/valory/erc20/0.1.0": "bafybeichh4vg3mav7pkv4nymw4wpnnyhd6lm2uzmjpcsrqetxi2x4g7b2m", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeigd4qfjllcyembuwap5jow7r63vinlzdixad6br4g5esxxgwn3zvu", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeiesf2zztqhie7rpsrglddc7lbjfjxtybqsqhlmtp77ukddejrmiva", "contract/valory/mech/0.1.0": "bafybeigbpvjbdnxwwxlee47thv2xuwxk4qte7k6yxzuv4qlczl5ecjh6ie", "contract/valory/realitio/0.1.0": "bafybeic5ie4oodetj4krdogydvbfxg4qggc3matpiflocah626tpevpreq", "contract/valory/realitio_proxy/0.1.0": "bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4", diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index ff43eda6b..166da0902 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -44,10 +44,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeigkf7uh6zre3wc3btm2we7xffls4e4vurvtsou2nswbn6mcc3g52a - valory/termination_abci:0.1.0:bafybeif7dwj4i5okp7rsyeiyvnmt5xop7njvj27bmjqdx4skmimqls7t4e - valory/transaction_settlement_abci:0.1.0:bafybeic3ysdc46z4ipuonc2g6vdyqaxxljvfd45cflzi2xq7o7hre6lvvy -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeigd4qfjllcyembuwap5jow7r63vinlzdixad6br4g5esxxgwn3zvu +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeiesf2zztqhie7rpsrglddc7lbjfjxtybqsqhlmtp77ukddejrmiva - valory/market_manager_abci:0.1.0:bafybeif23nzty3mvhvx3tphgr3mdrfo4kadxzg4zi57at2pqvml5yrb2xa -- valory/decision_maker_abci:0.1.0:bafybeigklkydkulavsuk2xkau5qlpggc7hmbre57jmxgcmonrlo6siidg4 -- valory/trader_abci:0.1.0:bafybeidexy2xjeswefufqv7ygu3hyfa4zdesmjkbfq3oqy266jgykfbrmm +- valory/decision_maker_abci:0.1.0:bafybeidh3efbssuohhuku5b4go5jeqti4xv6dsdpaxm3ti4rudgqmyujpq +- valory/trader_abci:0.1.0:bafybeifildb45hkpmusursxm3n7tg6bw42xfn4ssa2b7k73tu3og3nesze - valory/staking_abci:0.1.0:bafybeifflsc3m5pvxrbhih4xclslhpqdnryilp72wudqffvvttyiung76u default_ledger: ethereum required_ledgers: diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index bebb31e60..7213f0574 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeihdduvxtmsbvdxlhf3xqf4rydcjezx2i5nfq3nxxrozziai5khlma +agent: valory/trader:0.1.0:bafybeihddqmhwhnelfclqocgahnbb4ipdhkatqsttl5acne62ifupfaw7i number_of_agents: 4 deployment: {} --- diff --git a/packages/valory/skills/decision_maker_abci/fsm_specification.yaml b/packages/valory/skills/decision_maker_abci/fsm_specification.yaml index 4b5e198b1..d6d2314af 100644 --- a/packages/valory/skills/decision_maker_abci/fsm_specification.yaml +++ b/packages/valory/skills/decision_maker_abci/fsm_specification.yaml @@ -91,6 +91,7 @@ transition_func: (SamplingRound, NO_MAJORITY): SamplingRound (SamplingRound, ROUND_TIMEOUT): SamplingRound (SubscriptionRound, DONE): FinishedSubscriptionRound + (SubscriptionRound, NONE): SubscriptionRound (SubscriptionRound, NO_MAJORITY): SubscriptionRound (SubscriptionRound, NO_SUBSCRIPTION): RandomnessRound (SubscriptionRound, ROUND_TIMEOUT): SubscriptionRound diff --git a/packages/valory/skills/decision_maker_abci/rounds.py b/packages/valory/skills/decision_maker_abci/rounds.py index 967d28f09..6b4df9e4e 100644 --- a/packages/valory/skills/decision_maker_abci/rounds.py +++ b/packages/valory/skills/decision_maker_abci/rounds.py @@ -88,6 +88,7 @@ class DecisionMakerAbciApp(AbciApp[Event]): 1. SubscriptionRound - done: 14. - no subscription: 3. + - none: 1. - subscription error: 1. - no majority: 1. - round timeout: 1. @@ -174,6 +175,7 @@ class DecisionMakerAbciApp(AbciApp[Event]): SubscriptionRound: { Event.DONE: FinishedSubscriptionRound, Event.NO_SUBSCRIPTION: RandomnessRound, + Event.NONE: SubscriptionRound, Event.SUBSCRIPTION_ERROR: SubscriptionRound, Event.NO_MAJORITY: SubscriptionRound, Event.ROUND_TIMEOUT: SubscriptionRound, diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index c7d9a4c37..ad45d1848 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -26,7 +26,7 @@ fingerprint: behaviours/sampling.py: bafybeibtkli72qsvotkrsepkgpiumtr5sershtkpb427oygnszs3dpgxry behaviours/tool_selection.py: bafybeicxw4je76uc7znx4u2hq2b2aaxcf7blwfla7lhdhkqnf3kkupsczq dialogues.py: bafybeigpwuzku3we7axmxeamg7vn656maww6emuztau5pg3ebsoquyfdqm - fsm_specification.yaml: bafybeic2brgmxbuza2ztpb554ggubt66xxj7leuynbcjmym235doq6qi5y + fsm_specification.yaml: bafybeigxmyqggc6m5jmmnw5cugfcr7irugjrn6jffgc3q2snevuvcan7zu handlers.py: bafybeiggoetspwcvdojmbjdd67tmkoeedikmt6vsbcium3zjaljb6jzqu4 io_/__init__.py: bafybeifxgmmwjqzezzn3e6keh2bfo4cyo7y5dq2ept3stfmgglbrzfl5rq io_/loader.py: bafybeih3sdsx5dhe4kzhtoafexjgkutsujwqy3zcdrlrkhtdks45bc7exa @@ -34,7 +34,7 @@ fingerprint: payloads.py: bafybeibmjrckgsflqulviynadl6bx3keuabvhfolkiib7cmjhfsov2vuty policy.py: bafybeihca4gc5gdj3wmvtzulqq3cr4zm6ouyt7aoscfedutzr4so4bksna redeem_info.py: bafybeifiiix4gihfo4avraxt34sfw35v6dqq45do2drrssei2shbps63mm - rounds.py: bafybeigisg437wfshf5xc3uxjpru4x74be4lj6ieoxsba6klkkmg7dz5ni + rounds.py: bafybeih6bo7nnc7hvg67svio3f6cwob55qp4bgxjcejsmj6el3zhltz7bq states/__init__.py: bafybeid23llnyp6j257dluxmrnztugo5llsrog7kua53hllyktz4dqhqoy states/base.py: bafybeid4khumtvfw5n37avkf3kujfxdwhfjcsnzpmyjeljkpcako5f2duy states/bet_placement.py: bafybeibalhxhp2c4oljmiwqi6ds3g36fgtabmf42mb5sgq6z22znrcbhda diff --git a/packages/valory/skills/trader_abci/fsm_specification.yaml b/packages/valory/skills/trader_abci/fsm_specification.yaml index cb5e97ea6..a9fb222d7 100644 --- a/packages/valory/skills/trader_abci/fsm_specification.yaml +++ b/packages/valory/skills/trader_abci/fsm_specification.yaml @@ -183,6 +183,7 @@ transition_func: (SelectKeeperTransactionSubmissionBRound, NO_MAJORITY): ResetRound (SelectKeeperTransactionSubmissionBRound, ROUND_TIMEOUT): SelectKeeperTransactionSubmissionBRound (SubscriptionRound, DONE): PreTxSettlementRound + (SubscriptionRound, NONE): SubscriptionRound (SubscriptionRound, NO_MAJORITY): SubscriptionRound (SubscriptionRound, NO_SUBSCRIPTION): RandomnessRound (SubscriptionRound, ROUND_TIMEOUT): SubscriptionRound diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index 018f35226..eb42c7478 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -11,7 +11,7 @@ fingerprint: behaviours.py: bafybeieesrefrpo5c5upzztgm5fwfrmxeagilacuau5nacobhsfvgpbzby composition.py: bafybeif75v3swf2pmxi3rdd5kqdfv4ap5uapcbszkiohhur67oemrgotay dialogues.py: bafybeiebofyykseqp3fmif36cqmmyf3k7d2zbocpl6t6wnlpv4szghrxbm - fsm_specification.yaml: bafybeihrf45yaqlq37ro3todw7f2p43eugirtnsefr6345f4n5v44q3nuu + fsm_specification.yaml: bafybeiclt5bzaw66fqjlt2edu5ia26k4vbuto3dxhtgzdr2crcc7hxotfi handlers.py: bafybeibkiqwe7hoqccjirimd44nzeqkabc7oo74romqklssion27s5sa2a models.py: bafybeibrxivgpzamfmrl6bdngi67g72i32lmu5vgdn3jbwka265blk7ire fingerprint_ignore_patterns: [] @@ -25,8 +25,8 @@ skills: - valory/transaction_settlement_abci:0.1.0:bafybeic3ysdc46z4ipuonc2g6vdyqaxxljvfd45cflzi2xq7o7hre6lvvy - valory/termination_abci:0.1.0:bafybeif7dwj4i5okp7rsyeiyvnmt5xop7njvj27bmjqdx4skmimqls7t4e - valory/market_manager_abci:0.1.0:bafybeif23nzty3mvhvx3tphgr3mdrfo4kadxzg4zi57at2pqvml5yrb2xa -- valory/decision_maker_abci:0.1.0:bafybeigklkydkulavsuk2xkau5qlpggc7hmbre57jmxgcmonrlo6siidg4 -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeigd4qfjllcyembuwap5jow7r63vinlzdixad6br4g5esxxgwn3zvu +- valory/decision_maker_abci:0.1.0:bafybeidh3efbssuohhuku5b4go5jeqti4xv6dsdpaxm3ti4rudgqmyujpq +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeiesf2zztqhie7rpsrglddc7lbjfjxtybqsqhlmtp77ukddejrmiva - valory/staking_abci:0.1.0:bafybeifflsc3m5pvxrbhih4xclslhpqdnryilp72wudqffvvttyiung76u behaviours: main: diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index c2942dca3..76655230a 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -21,7 +21,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeihdk6psr4guxmbcrc26jr2cbgzpd5aljkqvpwo64bvaz7tdti2oni skills: - valory/abstract_round_abci:0.1.0:bafybeibna634t4w4udainzsuxwfydkbcy33alcqy6ugalcfuhoyhr53gs4 -- valory/decision_maker_abci:0.1.0:bafybeigklkydkulavsuk2xkau5qlpggc7hmbre57jmxgcmonrlo6siidg4 +- valory/decision_maker_abci:0.1.0:bafybeidh3efbssuohhuku5b4go5jeqti4xv6dsdpaxm3ti4rudgqmyujpq - valory/staking_abci:0.1.0:bafybeifflsc3m5pvxrbhih4xclslhpqdnryilp72wudqffvvttyiung76u behaviours: main: