ApeWorX / ape

The smart contract development tool for Pythonistas, Data Scientists, and Security Professionals
https://apeworx.io
Apache License 2.0
868 stars 133 forks source link

Refactor: EcosystemAPI #528

Open NotPeopling2day opened 2 years ago

NotPeopling2day commented 2 years ago

Overview

Refactor EcosystemAPI and associated types

Specification

Dependencies

509

antazoey commented 2 years ago

TransactionAPI might be over-specified : Care to elaborate on this one?

fubuloubu commented 2 years ago

TransactionAPI might be over-specified : Care to elaborate on this one?

We have max_fee and max_priority_fee in the core TransactionAPI type. Thinking more abstractly, there isn't really a need to have these txn types specify this data directly. Perhaps there is a smarter way where those fields are left out of TransactionAPI (and end up in their contract classes), and just keep an abstractmethod like max_total_fee that returns whatever the concrete implementation considers to be the maximum amount of ETH that would be spent. This is useful for other functions like detecting if a user has enough ETH to send the transaction.

If you want to query base_fee from the transaction, well that field wouldn't be available in TransactionAPI, you would have to be certain you are working with DynamicFeeTransaction concrete classes that implement this field in their data model.

antazoey commented 2 years ago

Thank you for adding this info!

I agree, those fields only matter during serialization and can be handled at the implementation level.