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 Cowswap oracle #353

Merged
merged 2 commits into from
Sep 16, 2022
Merged

Add Cowswap oracle #353

merged 2 commits into from
Sep 16, 2022

Conversation

Uxio0
Copy link
Member

@Uxio0 Uxio0 commented Sep 9, 2022

@Uxio0 Uxio0 requested a review from a team as a code owner September 9, 2022 10:10
@coveralls
Copy link

coveralls commented Sep 9, 2022

Pull Request Test Coverage Report for Build 3022306946

  • 81 of 87 (93.1%) changed or added relevant lines in 9 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.008%) to 90.005%

Changes Missing Coverage Covered Lines Changed/Added Lines %
gnosis/protocol/gnosis_protocol_api.py 14 15 93.33%
gnosis/safe/api/transaction_service_api.py 0 1 0.0%
gnosis/eth/oracles/cowswap.py 35 37 94.59%
gnosis/safe/api/base_api.py 2 4 50.0%
Files with Coverage Reduction New Missed Lines %
gnosis/safe/api/transaction_service_api.py 1 46.74%
Totals Coverage Status
Change from base Build 3006987365: -0.008%
Covered Lines: 3485
Relevant Lines: 3872

💛 - Coveralls

if "amount" in result:
# Decimals needs to be adjusted
token_2_decimals = get_decimals(token_address_2, self.ethereum_client)
return float(result["amount"]) / 10**token_2_decimals
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we use fractions here since we are dealing with financial decimal values?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a good idea, but I wouldn't do it as it would break oracle interface for all the implemented oracles. At some point we can refactor all the oracles to return Fraction


class TestCowswapOracle(EthereumTestCaseMixin, TestCase):
def test_get_price(self):
mainnet_node = just_test_if_mainnet_node()
Copy link
Contributor

Choose a reason for hiding this comment

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

OOC: is this testing the real node (E2E)?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's right, we are doing E2E for all oracle providers

@Uxio0 Uxio0 merged commit 984e407 into master Sep 16, 2022
@Uxio0 Uxio0 deleted the add-cowswap-oracle branch September 16, 2022 11:47
@github-actions github-actions bot locked and limited conversation to collaborators Sep 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants