safe-global / safe-core-sdk

The Safe{Core} SDK allows builders to add account abstraction functionality into their apps.
https://docs.safe.global/sdk/overview
MIT License
252 stars 196 forks source link

feat(protocol-kit): Refactor and improve contract classes for Abitype #758

Closed tmjssz closed 5 months ago

tmjssz commented 6 months ago

What it solves

Various code improvements to reduce duplicate code:

How this PR fixes it

Changing the abstraction order of the contract classes: abstract at adapter level before abstracting at contract-level. This allows to move the getAddress, encode + estimateGas functions into the abstract adapter-level classes (e.g. BaseContractEthers) instead of defining them for each contract individually.

Introducing the BaseContract class to handle the logic of selecting the appropriate ABI and the address from contract deployments. This new class replaces all the contract-specific base classes, such as SafeBaseContract.