Skip to content
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

Add support for collection of oracles to chains endpoint #210

Merged
merged 3 commits into from
Sep 6, 2021

Conversation

fmrsabino
Copy link
Contributor

@fmrsabino fmrsabino commented Sep 2, 2021

Closes #209

  • Breaking Change /api/v1/chains: each chain is now allowed to have multiple gas price configurations (resulting in a collection instead of a single object of fixed and oracle gas prices).
  • The new GasPrice for each chain is now ranked – a lower value means that it'd show up higher on the list (eg.: rank 1 > rank 100)
  • The new GasPrice collection is allowed to be empty – this is not only to reduce complexity but also because the current relationship between GasPrice <> Chain means that a Chain needs to exist first before assigning a GasPrice to it.

@fmrsabino fmrsabino self-assigned this Sep 2, 2021
Uxio0
Uxio0 previously approved these changes Sep 2, 2021
Chain = apps.get_model("chains", "Chain")
db_alias = schema_editor.connection.alias

GasPrice.objects.using(db_alias).bulk_create(
Copy link
Member

Choose a reason for hiding this comment

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

Just curious, is this using needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would say that it is not required reading this: https://docs.djangoproject.com/en/3.2/ref/models/querysets/#using

Since we are using just one DB. I think we can remove it 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed it here 60342d3

)


class GasPriceSerializer(serializers.Serializer):
Copy link
Member

Choose a reason for hiding this comment

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

Nice done

@fmrsabino fmrsabino merged commit 8ea9933 into main Sep 6, 2021
@fmrsabino fmrsabino deleted the oracle-collection branch September 6, 2021 12:05
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.

Gas price oracles should return a list instead a single oracle
2 participants