Last active
October 9, 2020 12:48
-
-
Save araa47/a42000ddcd94f67953560a90984883af to your computer and use it in GitHub Desktop.
Ocean Rinkeby Publish Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"from ocean_utils.agreements.service_factory import ServiceDescriptor\n", | |
"\n", | |
"from ocean_lib.ocean.ocean import Ocean\n", | |
"from ocean_lib.web3_internal.wallet import Wallet\n", | |
"from ocean_lib.ocean.util import to_base_18\n", | |
"from ocean_lib.data_provider.data_service_provider import DataServiceProvider\n", | |
"from dotenv import load_dotenv\n", | |
"from ocean_lib.config_provider import ConfigProvider\n", | |
"from ocean_lib.ocean.ocean import Ocean\n", | |
"from ocean_lib.models.dtfactory import DTFactory\n", | |
"\n", | |
"from ocean_lib.web3_internal.web3helper import Web3Helper\n", | |
"import os" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Log Level: DEBUG\n" | |
] | |
} | |
], | |
"source": [ | |
"load_dotenv()\n", | |
"\n", | |
"# Pre loaded rinkeby wallet \n", | |
"private_key = os.environ.get(\"WALLET_PRIVATE_KEY\")\n", | |
"\n", | |
"log_level = os.environ.get(\"LOG_LEVEL\")\n", | |
"print(f'Log Level: {log_level}')" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Alex from Ocean has set up \n", | |
"\n", | |
"You can use this on rinkeby: https://aquarius.d5dao.dev-ocean.com/ \n", | |
"\n", | |
" and https://provider.d5dao.dev-ocean.com/\n", | |
"\n", | |
"\n", | |
" I have also updated address.json to \n", | |
" \n", | |
" \n", | |
"```\n", | |
"{\n", | |
" \"Rinkeby\": {\n", | |
" \"DTFactory\": \"0x3fd7A00106038Fb5c802c6d63fa7147Fe429E83a\",\n", | |
" \"Ocean\": \"0x8967BCF84170c91B0d24D4302C2376283b0B3a07\",\n", | |
" \"BFactory\": \"0x53eDF9289B0898e1652Ce009AACf8D25fA9A42F8\",\n", | |
" \"FixedRateExchange\": \"0xeD1DfC5F3a589CfC4E8B91C1fbfC18FC6699Fbde\",\n", | |
" \"Metadata\": \"0xFD8a7b6297153397B7eb4356C47dbd381d58bFF4\"\n", | |
" }\n", | |
"}\n", | |
"\n", | |
"\n", | |
"```\n" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"\n", | |
"config = {\n", | |
" 'network' : 'rinkeby',\n", | |
" 'metadataStoreUrl' : 'https://aquarius.rinkeby.v3.dev-ocean.com/',\n", | |
" 'providerUri' : 'https://provider.rinkeby.v3.dev-ocean.com/api/v1',\n", | |
"'logger.debug': 'DEBUG'\n", | |
" }\n", | |
"\n", | |
"ocean = Ocean(config)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"test_wallet = Wallet(ocean.web3, private_key=private_key)\n" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"data_token = ocean.create_data_token(ocean.config.metadata_store_url, 'DataToken1', 'DT1', test_wallet)\n" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"token_address = data_token.address" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"'0x781572C9E6eD36dBFD200FF1842ffCD423b7b2A7'" | |
] | |
}, | |
"execution_count": 7, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"token_address" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 8, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# `ocean.assets.create` will encrypt the URLs using the provider's encrypt service endpoint and update \n", | |
"# the asset before pushing to metadata store\n", | |
"# `ocean.assets.create` will require that token_address is a valid DataToken contract address, unless token_address\n", | |
"# is not provided then the `create` method will first create a new data token and use it in the new\n", | |
"# asset.\n", | |
"metadata = {\n", | |
" \"main\": {\n", | |
" \"type\": \"dataset\", \"name\": \"10 Monkey Species Small\", \"author\": \"Mario\", \n", | |
" \"license\": \"CC0: Public Domain\", \"dateCreated\": \"2012-02-01T10:55:11Z\", \n", | |
" \"files\": [\n", | |
" { \"index\": 0, \"contentType\": \"application/zip\", \"url\": \"https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/assets/training.zip\"},\n", | |
" { \"index\": 1, \"contentType\": \"text/text\", \"url\": \"https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/assets/monkey_labels.txt\"},\n", | |
" { \"index\": 2, \"contentType\": \"application/zip\", \"url\": \"https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/assets/validation.zip\"}]}\n", | |
"}" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 9, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# Prepare attributes for the download service including the cost in DataTokens\n", | |
"service_attributes = {\n", | |
" \"main\": {\n", | |
" \"name\": \"dataAssetAccessServiceAgreement\",\n", | |
" \"creator\": test_wallet.address,\n", | |
" \"cost\": 1.0, # service cost is 1.0 tokens \n", | |
" \"timeout\": 3600 * 24,\n", | |
" \"datePublished\": metadata[\"main\"]['dateCreated']\n", | |
" }\n", | |
" }" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 10, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"service_endpoint = DataServiceProvider.get_download_endpoint(ocean.config)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 11, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"download_service = ServiceDescriptor.access_service_descriptor(service_attributes, \n", | |
" service_endpoint)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 13, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"signing message with nonce 0: 0x781572C9E6eD36dBFD200FF1842ffCD423b7b2A7, account=0x2e81C50e3c4197F434BE722d76a9139d4f9b0A86\n" | |
] | |
} | |
], | |
"source": [ | |
"asset = ocean.assets.create(metadata, \n", | |
" test_wallet, \n", | |
" service_descriptors=[download_service], \n", | |
" data_token_address=token_address, \n", | |
" provider_uri='https://provider.rinkeby.v3.dev-ocean.com/api/v1')" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 15, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"<ocean_lib.assets.asset.Asset at 0x7f60958e5dc0>" | |
] | |
}, | |
"execution_count": 15, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"asset" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# mint data tokens" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 16, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"'0x8095d34bdaf269d96b21020be3bc7c9617848bb0cd62507041890cb761fca53e'" | |
] | |
}, | |
"execution_count": 16, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"data_token.mint_tokens(test_wallet.address, 1000.0, test_wallet)\n" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# pool" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 17, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"BPool.newBPool(). Begin.\n", | |
" pool_address = 0x79340df56F649801C3862631C2bcCEc4eCD3c989\n", | |
"BFactory.newBPool(). Done.\n" | |
] | |
}, | |
{ | |
"name": "stderr", | |
"output_type": "stream", | |
"text": [ | |
"/home/rex/.cache/pypoetry/virtualenvs/ocean2-7Mvm0r1M-py3.8/lib/python3.8/site-packages/websockets/protocol.py:740: DeprecationWarning: 'with (yield from lock)' is deprecated use 'async with lock' instead\n", | |
" with (yield from self._drain_lock):\n", | |
"/home/rex/.cache/pypoetry/virtualenvs/ocean2-7Mvm0r1M-py3.8/lib/python3.8/site-packages/websockets/protocol.py:334: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.\n", | |
" done, pending = yield from asyncio.wait(\n" | |
] | |
}, | |
{ | |
"ename": "ValueError", | |
"evalue": "{'code': -32000, 'message': 'replacement transaction underpriced'}", | |
"output_type": "error", | |
"traceback": [ | |
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", | |
"\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", | |
"\u001b[0;32m<ipython-input-17-adc53ba34526>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m pool = ocean.pool.create(\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0mtoken_address\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0mdata_token_amount\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m500.0\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mOCEAN_amount\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m5.0\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mfrom_wallet\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mtest_wallet\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | |
"\u001b[0;32m~/.cache/pypoetry/virtualenvs/ocean2-7Mvm0r1M-py3.8/lib/python3.8/site-packages/ocean_lib/ocean/ocean_pool.py\u001b[0m in \u001b[0;36mcreate\u001b[0;34m(self, data_token_address, data_token_amount, OCEAN_amount, from_wallet, data_token_weight, swap_fee)\u001b[0m\n\u001b[1;32m 68\u001b[0m \u001b[0mdt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mapprove_tokens\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpool_address\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdata_token_amount\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfrom_wallet\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 69\u001b[0m \u001b[0mot\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mDataToken\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mocean_address\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 70\u001b[0;31m \u001b[0mot\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mapprove_tokens\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpool_address\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mOCEAN_amount\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfrom_wallet\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 71\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 72\u001b[0m tx_id = pool.setup(\n", | |
"\u001b[0;32m~/.cache/pypoetry/virtualenvs/ocean2-7Mvm0r1M-py3.8/lib/python3.8/site-packages/ocean_lib/models/data_token.py\u001b[0m in \u001b[0;36mapprove_tokens\u001b[0;34m(self, spender, value, from_wallet)\u001b[0m\n\u001b[1;32m 223\u001b[0m \u001b[0;31m# the transaction\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 224\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mapprove_tokens\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mspender\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mfloat\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfrom_wallet\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mWallet\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 225\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mapprove\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mspender\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mto_base_18\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mvalue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfrom_wallet\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 226\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 227\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mmint_tokens\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mto_account\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mfloat\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfrom_wallet\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mWallet\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | |
"\u001b[0;32m~/.cache/pypoetry/virtualenvs/ocean2-7Mvm0r1M-py3.8/lib/python3.8/site-packages/ocean_lib/models/data_token.py\u001b[0m in \u001b[0;36mapprove\u001b[0;34m(self, spender, value_base, from_wallet)\u001b[0m\n\u001b[1;32m 266\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 267\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mapprove\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mspender\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue_base\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mint\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfrom_wallet\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mWallet\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 268\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msend_transaction\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'approve'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mspender\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue_base\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfrom_wallet\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 269\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 270\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mtransfer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mto\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue_base\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mint\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfrom_wallet\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mWallet\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | |
"\u001b[0;32m~/.cache/pypoetry/virtualenvs/ocean2-7Mvm0r1M-py3.8/lib/python3.8/site-packages/ocean_lib/web3_internal/contract_base.py\u001b[0m in \u001b[0;36msend_transaction\u001b[0;34m(self, fn_name, fn_args, from_wallet, transact)\u001b[0m\n\u001b[1;32m 162\u001b[0m \u001b[0m_transact\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mupdate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtransact\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 163\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 164\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mcontract_function\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtransact\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_transact\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mhex\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 165\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 166\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mget_event_argument_names\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mevent_name\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | |
"\u001b[0;32m~/.cache/pypoetry/virtualenvs/ocean2-7Mvm0r1M-py3.8/lib/python3.8/site-packages/ocean_lib/web3_internal/web3_overrides/contract.py\u001b[0m in \u001b[0;36mtransact\u001b[0;34m(self, transaction)\u001b[0m\n\u001b[1;32m 58\u001b[0m \u001b[0mtransact_transaction\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'gas'\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgas\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 59\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 60\u001b[0;31m return transact_with_contract_function(\n\u001b[0m\u001b[1;32m 61\u001b[0m \u001b[0mcf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0maddress\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 62\u001b[0m \u001b[0mcf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mweb3\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | |
"\u001b[0;32m~/.cache/pypoetry/virtualenvs/ocean2-7Mvm0r1M-py3.8/lib/python3.8/site-packages/ocean_lib/web3_internal/web3_overrides/contract.py\u001b[0m in \u001b[0;36mtransact_with_contract_function\u001b[0;34m(address, web3, function_name, transaction, contract_abi, fn_abi, *args, **kwargs)\u001b[0m\n\u001b[1;32m 113\u001b[0m \u001b[0mraw_tx\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mWallet\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mweb3\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mprivate_key\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0maccount_key\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msign_tx\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtransact_transaction\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 114\u001b[0m \u001b[0mlogging\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdebug\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mf'sending raw tx: function: {function_name}, tx hash: {raw_tx.hex()}'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 115\u001b[0;31m \u001b[0mtxn_hash\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mweb3\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0meth\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msendRawTransaction\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mraw_tx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 116\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mpassphrase\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 117\u001b[0m \u001b[0mtxn_hash\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mweb3\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpersonal\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msendTransaction\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtransact_transaction\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpassphrase\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | |
"\u001b[0;32m~/.cache/pypoetry/virtualenvs/ocean2-7Mvm0r1M-py3.8/lib/python3.8/site-packages/web3/eth.py\u001b[0m in \u001b[0;36msendRawTransaction\u001b[0;34m(self, raw_transaction)\u001b[0m\n\u001b[1;32m 270\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 271\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0msendRawTransaction\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mraw_transaction\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 272\u001b[0;31m return self.web3.manager.request_blocking(\n\u001b[0m\u001b[1;32m 273\u001b[0m \u001b[0;34m\"eth_sendRawTransaction\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 274\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mraw_transaction\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | |
"\u001b[0;32m~/.cache/pypoetry/virtualenvs/ocean2-7Mvm0r1M-py3.8/lib/python3.8/site-packages/web3/manager.py\u001b[0m in \u001b[0;36mrequest_blocking\u001b[0;34m(self, method, params)\u001b[0m\n\u001b[1;32m 110\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 111\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;34m\"error\"\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mresponse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 112\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mresponse\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"error\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 113\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 114\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mresponse\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'result'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | |
"\u001b[0;31mValueError\u001b[0m: {'code': -32000, 'message': 'replacement transaction underpriced'}" | |
] | |
} | |
], | |
"source": [ | |
"pool = ocean.pool.create(\n", | |
" token_address,\n", | |
" data_token_amount=500.0,\n", | |
" OCEAN_amount=5.0,\n", | |
" from_wallet=test_wallet\n", | |
")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.8.5" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 4 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment