Skip to content

Multiple orders #669

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 20, 2022
Merged

Multiple orders #669

merged 4 commits into from
Jan 20, 2022

Conversation

calina-c
Copy link
Contributor

@calina-c calina-c commented Jan 20, 2022

Work on #639.

Here's the current state of this: we need to manually convert NamedTuples to regular tuples. I tested this functionality with our current web3.py and it works properly, but it means we can not use higher level APIs such as nested tuples, tuple lists and named tuples without converting them manually.

Testing with my changes in the web3.py, we can safely remove the forced conversions, which are now marked with a TODO.


My plan is to standardise all tuple sending inside ocean.py after this fix is merged into web3.py. This way, we can allow users to use regular tuples, dictionaries etc. but we can also standardise and reuse NamedTuple structures throughout our application. E.g. provider fees, ERC20 create data, Pool data, FRE data, OrderData etc. Right now, the structures are all over the place e.g.:

  • we use the CreateERC20 tuple directly inside of some functions, regular tuples in others. We can not offer both options at once (see regular creation vs. factory creation for simultaneous creation of ERC721 and ERC20)
  • we depend on "knowing" the contents of our tuples instead of sending them as passthroughs, meaning whenever some item will change, it will have to change thoughout the entire application
  • ProviderFees is reused many times, but it is the opposite of DRY. Instead of reusing a specific NamedTuple structure, we redefine its components everywhere we reuse it.
  • without a data structure, with "free" tuples inside the application, any changes are tedious and need attention to ordering etc.

Should we create a separate issue for this? While it is true that this PR fixes a blocker, I would like to add this tuple standardisation into ocean.py since it will greatly benefit us and our users.

@calina-c calina-c changed the base branch from main to v4main January 20, 2022 09:06
@calina-c calina-c requested a review from mariacarmina January 20, 2022 09:24
@@ -519,7 +515,7 @@ def test_start_multiple_order(

# Tests starting multiple token orders successfully
erc20_token = ERC20Token(web3, erc20_address)
dt_amount = web3.toWei("0.05", "ether")
dt_amount = web3.toWei("2", "ether")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use to_wei here please?

@calina-c calina-c temporarily deployed to CC_REPORTER_ID January 20, 2022 09:37 Inactive
@calina-c calina-c temporarily deployed to CC_REPORTER_ID January 20, 2022 09:37 Inactive
@calina-c calina-c merged commit f634c88 into v4main Jan 20, 2022
@calina-c calina-c deleted the multiple-orders branch January 20, 2022 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants